Hello everyone,
Ive made a program to display some stuff on my lcd, being controlled by keypad. Now what i want is to serially transmit this data to Xigbee module which will then transmit it wirelessly to other module. What commands shall i add up in my program? Program is displayed below:
Code:
Define LOADER_USED 1
' Define LCD connections
DEFINE OSC 20
DEFINE LCD_DREG PORTD
define LCD_DBIT 0
DEFINE LCD_RSREG PORTE
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTE
DEFINE LCD_EBIT 1
DEFINE LCD_RWREG PORTE
DEFINE LCD_RWBIT 2
DEFINE LCD_BITS 8
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
col var byte '=p
row var byte ' Keypad row
key var byte ' Key value
a var word
OPTION_REG.7 = 0
ADCON1 = 7 ' Make PORTA and PORTE digital
Low PORTE.2 ' LCD R/W low (write)
Pause 500 ' Wait for LCD to start
TRISD = %00000000
TRISE = %00000000
LCDOUT $FE, 1, "WELCOME 2 BBQ2NYT"
LCDOUT $FE,$C0, " RESTAURANT "
PAUSE 1500
LCDOUT $FE,1,"ORDER HERE"
PAUSE 1500
order1:
Lcdout $fe,1, "2: Bhindi U"
LCDOUT $FE,$C0, "3: Dahi B >"
Gosub getkey1 ' Get a key from the keypad
if key1= 2 OR key1=3 then goto quantity
if key1=1 then goto order2
goto order1
' Subroutine to get a key from keypad
getkey1:
PAUSE 50 'Debounce key-input
PAUSE 50 ' Debounce key-input
getkeyu2:' Wait for all keys up
PORTB = 0 ' All output-pins low
TRISB = $f0 ' Bottom 4-pins out, top 4-pins in
IF ((PORTB >> 4) != $f) THEN getkeyu'If keys down, loop
getkeyp3:' Wait for keypress
col = 0 ' 4 rows in keypad
PORTB = 0 ' All output-pins low
TRISB = (DCD col) ^ $ff ' Set one row pin to output
row = PORTB >> 4 ' Read columns
IF row = %00001110 THEN gotkey' If any keydown, exit
GOTO getkeyp ' No keys down, go look again
gotkey4: ' Change row and column to key number 1 - 16
key = (col * 4) + (NCD (row ^ $f))
'NOTE: for 12-key keypad, change to key = (row * 3)
RETURN
order2:
Lcdout $fe,1, "4: Bhindi F ^"
LCDOUT $FE,$C0, "5: Dahi B M"
Gosub getkey1
if key=4 OR key=5 then goto quantity
if key=1 then goto order1
goto order2
quantity:
lcdout $fe, 1, "Enter Quantity: "
Gosub getkey
Lcdout $fe, 1, #key
pause 1500
orderagain:
lcdout $fe, 1, "Order Again?"
LCDOUT $FE,$C0, "Yes: 1. No: C"
gosub getkey
if key=1 then goto order1
if key=12 then goto display
goto orderagain
LCDOUT fe, 1, "You have ordered: "
goto yourorder
display: lcdout $fe, 1, "Thank you."
yourorder:
if key1=2 then lcdout "Bhindi F"
if key
' Subroutine to get a key from keypad
getkey:
PAUSE 50 'Debounce key-input
PAUSE 50 ' Debounce key-input
getkeyu:' Wait for all keys up
PORTB = 0 ' All output-pins low
TRISB = $f0 ' Bottom 4-pins out, top 4-pins in
IF ((PORTB >> 4) != $f) THEN getkeyu'If keys down, loop
getkeyp:' Wait for keypress
for col=0 to 3 ' 4 rows in keypad
PORTB = 0 ' All output-pins low
TRISB = (DCD col) ^ $ff ' Set one row pin to output
row = PORTB >> 4 ' Read columns
If row != $f THEN gotkey' If any keydown, exit
next col
GOTO getkeyp ' No keys down, go look again
gotkey: ' Change row and column to key number 1 - 16
key = (col * 4) + (NCD (row ^ $f))
'NOTE: for 12-key keypad, change to key = (row * 3)
RETURN ' Subroutine over
END
P.S: The lines which are bold i want them to be transmitted.
Bookmarks