kgavionics
Full Member level 3
- Joined
- Jun 12, 2012
- Messages
- 167
- Helped
- 7
- Reputation
- 14
- Reaction score
- 11
- Trophy points
- 1,298
- Location
- Alberta.Canada
- Activity points
- 2,482
hi
i'm trying to hook up an LCD display based on the samsung KS0066 chip which is compliant with the hitachi4780. I uploaded my code into the chip in proteus sim and everything seems to work fine,but my problem is with the actual chip
on my breadboard nothing is not working exept the Lcd backlight lol.
here's my code (copied from a the book Embeded systems with pic by Charles Kim)
can someone help me what's going wrong?
thank you in advance
i'm trying to hook up an LCD display based on the samsung KS0066 chip which is compliant with the hitachi4780. I uploaded my code into the chip in proteus sim and everything seems to work fine,but my problem is with the actual chip
on my breadboard nothing is not working exept the Lcd backlight lol.
here's my code (copied from a the book Embeded systems with pic by Charles Kim)
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 ;LCD-P.asm ; ;This program is to display an 20x4 LCD module ;by Truly (HD44780 compatible) ; ;8-bit interfacing ; ;Pin Connection from LCD to 16F877 ;LCD (pin#) 16F877 (pin#) ;DB7 (14) -----RB7(40) ;DB6 (13) ----RB6(39) ;DB5 (12) ----RB5(38) ;DB4 (11) ----RB4(37) ;DB3 (10) ----RB3(36) ;DB2 (9)---- RB2(35) ;DB1 (8) ----RB1(34) ;DB0 (7) ----RB0(33) ;E (6) ------RD5(28) ;RW (5) -----RD6(29) ;RS (4) -----RD4(27) ;Vo (3) -----+5V ;Vdd (2) ----+5V ;Vss (1) -----GND ; ;Example code to display: ; PIC ; AND ; LCD ; DISPLAY ; list P = 16F877 STATUS EQU 0x03 PORTB EQU 0x06 TRISB EQU 0x86 PORTD EQU 0x08 TRISD EQU 0x88 RS EQU 0x04 ;RD4 E EQU 0x05 ;RD5 RW EQU 0x06 ;RW ;RAM arEA CBLOCK 0x20 Kount120us ;Delay count (number of instr cycles for delay) Kount100us Kount1ms Kount10ms Kount1s Kount10s Kount1m ENDC ; ;The Next 5 lines must be here ;because of bootloader arrangement ;Bootloader first execute the first 4 addresses ;then jump to the address what the execution directs ;========================================================= org 0x0000 ;line 1 goto START ;line 2 ($0000) org 0x05 delay120us banksel Kount120us movlw H'C5' ;D'197' movwf Kount120us R120us decfsz Kount120us goto R120us return ; delay100us banksel Kount100us movlw H'A4' movwf Kount100us R100us decfsz Kount100us goto R100us return ; ;1ms delay delay1ms banksel Kount1ms movlw 0x0A ;10 movwf Kount1ms R1ms call delay100us decfsz Kount1ms goto R1ms return ; ;10ms delay ; call 100 times of 100 us delay (with some time discrepancy) delay10ms banksel Kount10ms movlw H'64' ;100 movwf Kount10ms R10ms call delay100us decfsz Kount10ms goto R10ms return ; ;1 sec delay ;call 100 times of 10ms delay delay1s banksel Kount1s movlw H'64' movwf Kount1s R1s call delay10ms decfsz Kount1s goto R1s return ; ;10 s delay ;call 10 tiems of 1 s delay delay10s banksel Kount10s movlw H'0A' ;10 movwf Kount10s R10s call delay1s decfsz Kount10s goto R10s return ; ;1 min delay ;call 60 times of 1 sec delay delay1m banksel Kount1m movlw H'3C' ;60 movwf Kount1m R1m call delay1s decfsz Kount1m goto R1m return START BANKSEL TRISD ; 1 for input, 0 for output movlw 0x00 movwf TRISD movwf TRISB ;RB<7:0> are all outputs banksel PORTB clrf PORTB clrf PORTD ;Here RW is pulled down to ground ;LCD routine starts call delay10ms ;give LCD module to reset automatically ;Fundtion for 8-bit, 2-line display, and 5x8 dot matrix movlw 0x38 call instw ;Display On, CUrsor On, No blinking movlw 0x0E ;0F would blink call instw ;DDRAM address increment by one & cursor shift to right movlw 0x06 call instw ;DISPLAY CLEAR movlw 0x01 call instw ;Set DDRAM ADDRES movlw 0x80 ;00 call instw ;WRITE DATA in the 1st position of line 1 movlw 0x50 ;P call dataw movlw 0x49 ;I call dataw movlw 0x43 ;C call dataw ;Set DDRAM address for the 1st position of line 2 (40h) movlw 0xC0 ;B'11000000' call instw ;RS=0 ;Write A, N, D movlw 0x41 ;A call dataw movlw 0x4E call dataw ;N movlw 0x44 call dataw ;D ;Set DDRAM address for the next 3 characters (L, C, and D) in line #3. (14h) ;The DDRAM address starts from 14h for the line #3. movlw 0x94 ;B'10010000' call instw ;RS=0 ;Write the three characters, 'L', 'C', and 'D' to DDRAM. ;They are displayed at the line #3 from position 1. movlw 0x4C ;L call dataw movlw 0x43 call dataw ;C movlw 0x44 call dataw ; movlw 0xD4 call instw ;RS=0 ;Write the seven characters, 'D', 'I', 'S', 'P', 'L', 'A', and 'Y' to DDRAM. ;They are displayed at the line #4 from position 1. movlw 0x44 ;D call dataw movlw 0x49 ;I call dataw movlw 0x53 ;S call dataw ; movlw 0x50 ;P call dataw movlw 0x4C ;L call dataw movlw 0x41 ;A call dataw movlw 0x59 ;Y call dataw ;Now let's move the cursor to the home position (position 1 of line #1) ;and set the DDRAM address to 0. This is done by the "return home" instruction. movlw 0x02 call instw IDLE nop goto IDLE ;====SUBROUTINES ===== ;subroutine instw (instruction write) ;instruction to be written is stored in W before the call instw movwf PORTB call delay1ms ;delay may not be needed bcf PORTD, RS call delay1ms bsf PORTD, E call delay1ms bcf PORTD,E call delay10ms return ;subroutine dataw (data write) dataw movwf PORTB call delay1ms ;delay may not be needed bsf PORTD, RS call delay1ms bsf PORTD, E call delay1ms bcf PORTD, E ;Transitional E signal call delay10ms return ; ;========================================================== ;DELAY SUBROUTINES ;======== END
can someone help me what's going wrong?
thank you in advance