OpenCores
URL https://opencores.org/ocsvn/copyblaze/copyblaze/trunk

Subversion Repositories copyblaze

[/] [copyblaze/] [trunk/] [copyblaze/] [sw/] [code/] [pbcc/] [lcd/] [lcd.c] - Blame information for rev 54

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 54 ameziti
//#include <stdio.h>
2
 
3
void __port_write(char port, char arg) { }
4
char __port_read(char port) { }
5
void __nop() { }
6
 
7
#define LED_wr(arg)  __port_write(0x80, (arg))
8
 
9
#define LCD_wr(arg)   __port_write(0x01, (arg))
10
#define LCD_rd()   __port_read(0x01)
11
#define LCD_busy()  (LCD_rd() & 0x80) == 0x80
12
 
13
void delay_ms(int ms)
14
{
15
 int i;
16
 for (i=0;i<ms;i++) {
17
   for (i=0; i < 10000; i++) __nop();
18
 }
19
}
20
 
21
void LCD_init()
22
{
23
  LCD_wr(0x42);
24
  while (LCD_rd()) { __nop();}
25
  LCD_wr(0x43);
26
 delay_ms(10);
27
  LCD_wr(0x44);
28
  LCD_wr(0x45);
29
}
30
 
31
void LCD_write(char ch)
32
{
33
  LCD_wr(0x46);
34
  LCD_wr(0x47);
35
}
36
 
37
 
38
int main(void) {
39
 char st = 0;
40
 
41
 while(1) {
42
   LED_wr(st);
43
   st ^= 1;
44
   delay_ms(1000);
45
 }
46
/*
47
 char ch = 0x31;
48
 LCD_init();
49
 while (1) {
50
   LCD_write(ch);
51
   delay_ms(1000);
52
 }
53
*/
54
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.