PDA

View Full Version : Transmission!



uaf5000
- 21st August 2010, 12:08
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:



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.

Acetronics2
- 21st August 2010, 18:37
Hi,

Too late for this evening ... your meal is somewhat burnt !!! ... :p

without knowing more about your ZigBee Module ... probably some serial output will be to use ...

Debug, Serout, Serout2 ... are the ones.

Alain

uaf5000
- 24th August 2010, 07:05
My Xbee is Xbee low power module. You can see more about it from here:

http://www.digi.com/products/wireless/point-multipoint/xbee-series1-module.jsp#overview

According to me i just have to serially send data to the radio and then it will transmit it. No more extra connections required. I just wanna know the particular commands for sending serial data (i.e through Tx and Rx pins of port C).

Regards.

mackrackit
- 24th August 2010, 09:14
according to me i just have to serially send data to the radio and then it will transmit it. No more extra connections required. i just wanna know the particular commands for sending serial data (i.e through tx and rx pins of port c).
serout2
hserout

Ioannis
- 24th August 2010, 13:10
How are you going to use the devices?

Do you have your own board or using the DIGI's dev kit?

The XBees require TTL Serial connection, not inversed by a driver when connecting to a microcontroller.

I suggest use the dev. kit to test them and set parameters, then connect to a micro.

Ioannis

uaf5000
- 25th August 2010, 03:07
Thanks Mack for the commands. But can u tell me precisely how to use them? Should there be some defines before i use these serial out commands? I have given the code, can you manipulate it accordingly?


I have Xbee XBIB board for one radio while ill plug the other radio in my own board where the microcontroller is placed (off course). I can set the parameters of my radio through this board and device software given by DIGI.

mackrackit
- 25th August 2010, 04:39
Thanks Mack for the commands. But can u tell me precisely how to use them? Should there be some defines before i use these serial out commands? I have given the code, can you manipulate it accordingly?

Hmmmm
I do not normally say this but.... RTFM
Then let us know the parts you do not understand.

HSERIN does have defines.