practice n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Practice PowerPoint Presentation
Download Presentation
Practice

Loading in 2 Seconds...

play fullscreen
1 / 11

Practice - PowerPoint PPT Presentation


  • 194 Views
  • Uploaded on

Practice. Asst. Prof. Dr. Alper SISMAN. Keypad/7-Segment Display. Keypad Matrix Keypad GND output keypad Serial output keypad Dipswitches 7-Segment Display Ex. Circuit ( HW details resistors etc.). 7-Segment display. Write all decimal numbers on the 7-segment.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Practice' - rosina


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
practice

Practice

Asst. Prof. Dr. Alper SISMAN

keypad 7 segment display
Keypad/7-Segment Display
  • Keypad
    • Matrix Keypad
    • GND output keypad
    • Serial output keypad
    • Dipswitches
  • 7-Segment Display
    • Ex. Circuit (HW details

resistors etc.)

7 segment display
7-Segment display
  • Write all decimal numbers on the 7-segment.
  • Design a simple counter (0-9) that counts the seconds.
use lcd in 4 bit mode
Use LCD in 4-bit mode

#include "STM32F4xx.h"

#define RS 32;

#define EN 8;

#define databits GPIOD->ODR

void SystemInit(){

(*((int*)0xE000ED88))|=0x0F00000; // Floating Point donaniminiaktiflestir.

RCC->AHB1ENR |= 0x0000000F; //

GPIOD->MODER = 0x00005555;

GPIOD->OTYPER = 0x0000000F;

//GPIOD->PUPDR = 0x00005555;

GPIOD->OSPEEDR= 0xFFFFFFFF

GPIOB->MODER = 0x00004440;

GPIOB->OTYPER = 0x00000028;

//GPIOB->PUPDR = 0x00000440;

GPIOB->OSPEEDR= 0xFFFFFFFF;

}

slide8

void cmd(unsigned char c)

{

GPIOB->BSRRH = RS;

delayyus(50);

GPIOD->ODR = (c >> 4);

LCD_STROBE();

databits = (c);

LCD_STROBE();

}

void delayyus(int delay0)

{ delay0-delay0*4;

while (delay0--)

{}

}

void LCD_STROBE(void)

{

GPIOB->BSRRL = EN;

delayyus(1); //1us bekle

GPIOB->BSRRH = EN;

}

voidclear(void)

{

cmd(0x01);

delayyus(2000);

}

void data (unsigned char c)

{

GPIOB->BSRRL = RS;

delayyus(50); //50us bekle

databits = (c >> 4);

LCD_STROBE();

databits = (c);

LCD_STROBE();}

void string1(const char *q)

{

while(*q)

{

data(*q++);

}}

slide9

voidlcd_init()

{

delayy1s(60000);

cmd(0x38);

delayy1s(4000);

cmd(0x38);

delayy1s(400);

cmd(0x38);

cmd(0x28);

cmd(0x28);

cmd(0x0c);

clear();

cmd(0x6);

}

int main (){

delayyus(50000);

lcd_init();

while(1)

{

cmd(0x80);

string1("HELLO WORLD");

cmd(0xc0);

string1("IT IS WORKING");

}

}

homework
Homework
  • Write a C code that gets the pushed button if the matrix keypad is used in previous slide.
  • The ASCII code of the pushed button should be written on a seven-segment display.
  • Design the HW and Firmware