Transmission!


Closed Thread
Results 1 to 7 of 7

Thread: Transmission!

  1. #1
    Join Date
    May 2010
    Posts
    19

    Default Transmission!

    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.
    Last edited by ScaleRobotics; - 21st August 2010 at 18:44. Reason: added code tags

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Default

    Hi,

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

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

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

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    May 2010
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    My Xbee is Xbee low power module. You can see more about it from here:

    http://www.digi.com/products/wireles...e.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.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    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
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,802


    Did you find this post helpful? Yes | No

    Default

    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

  6. #6
    Join Date
    May 2010
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    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.

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by uaf5000 View Post
    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.
    Dave
    Always wear safety glasses while programming.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts