Hello all,
since i didnt find anywhere in the forum the solutions or a thread for the following question, i would like to request your advice.
I'm currently building an RFID reader tag with PIC16F628a and LCD 2x16.
i'm trying to display the tag number on the LCD screen.
My problem is that i want to use SERIN2 for getting the tag number and the SEROUT2 for displaying it to the LCD.
Since i only know how to use 2x16LCD command as follows:
DEFINE LCD_DREG PORTB 'define port to LCD
DEFINE LCD_DBIT 4 'RB4 RB5 RB6 RB7 to D4 D5 D6 D7 display
DEFINE LCD_RSREG PORTA 'RS on porta
DEFINE LCD_RSBIT 0 'RS on porta.0
DEFINE LCD_EREG PORTA 'Enable on porta
DEFINE LCD_EBIT 1 'Numero Enable porta.1
DEFINE LCD_BITS 4 '
DEFINE LCD_LINES 2 'lines 2
So i have connected the pic16f628 according to the above configuration for the LCD 2x16.
I have also connected the RX pin in order to read the data from the RFID output data.
SERIN2 portb.1, 84, [WAIT($02), Str buf\10]
The problem is that the TX from the pic16f628a is not connected anywhere.
How do i display the tag number with serout2 command to an LCD 2x16?
or lets start from the very basic staff.
first of all to display something on the LCD using the serout2 command.
I dont understand how to use the portb.2 which is the TX port for the pic16f628a to the LCD.
thanks for any help.
the following is my code.
Code:
@ device pic16f628a
include "modedefs.bas"
CMCON = 7
define osc 8
DEFINE LCD_DREG PORTB 'define port to LCD
DEFINE LCD_DBIT 4 'RB4 RB5 RB6 RB7 to D4 D5 D6 D7 display
DEFINE LCD_RSREG PORTA 'RS on porta
DEFINE LCD_RSBIT 0 'RS on porta.0
DEFINE LCD_EREG PORTA 'Enable on porta
DEFINE LCD_EBIT 1 'Numero Enable porta.1
DEFINE LCD_BITS 4 '
DEFINE LCD_LINES 2 'lines 2
PAUSE 200 ' Stop 200ms
LCDOUT $FE,1 ' power lcd
Lcdout $FE,1,4
lcdout $FE, 1," Copyright 2011"
lcdout $FE, $C0,"Leonardo Bilalis"
pause 2000
lcdout $FE,1
' -----[ Variables ]-------------------------------------------------------
buf VAR byte [10]' RFID bytes buffer
tagNum VAR Byte ' from EEPROM table
idx VAR Byte ' tag byte index
char VAR Byte ' character from table
Main:
lcdout $FE,1," Please use your"
lcdout $FE, $C0," TAG"
pause 500
high portb.3
pause 500
SERIN2 portb.1, 84, [WAIT($02), Str buf\10]
pause 500
serout2 portb.2,84 [STR buf] 'this pin is nowhere connected :(
pause 1000 'Pause ,1 sec
goto main
Bookmarks