Coding for RF module with PIC 16F877A

Discussion in 'Embedded Systems and Microcontrollers' started by anak_ayam, Mar 29, 2008.

  1. anak_ayam

    Thread Starter New Member

    Mar 28, 2008
    2
    0
    Hi everyone,
    I'm doing my LAB project about bus monitoring system using the RF module-> TWS434/RWS434 . I'm using 2 piece of PIC16F877A for RF Tx and RF Rx and 2 LCD's which installed on transmitter board and receiver board.I also have 4x4 matrix keypad installed at transmitter board..what I'm doing now is when I press pad 1,2 and the others the character BUS01,BUS02.....will be display on LCD.But it's not finish.I want to send that Character and also display it on the receiver board.The problem is I don't know how to make a code to send the data.Below is the code for my keypad.
    please Help me with the coding..I will really appreciate it.


    ' PicBasic Pro program to display key number on LCD

    ' Define LOADER_USED to allow use of the boot loader.
    ' This will not affect normal program operation.
    Define LOADER_USED 1

    ' Define LCD connections
    define OSC 20

    DEFINE LCD_DREG PORTC 'LCD data port
    DEFINE LCD_DBIT 0 'LCD data starting bit 0 or 4
    DEFINE LCD_RSREG PORTB 'LCD register select port
    DEFINE LCD_RSBIT 7 'LCD register select bit
    DEFINE LCD_EREG PORTB 'LCD enable port
    DEFINE LCD_EBIT 5 'LCD enable bit
    DEFINE LCD_RWREG PORTB 'LCD read/write port
    DEFINE LCD_RWBIT 6 'LCD read/write bit
    DEFINE LCD_BITS 8 'LCD bus size 4 or 8
    DEFINE LCD_LINES 2 'Number lines on LCD
    DEFINE LCD_COMMANDUS 2000 'Command delay time in us
    DEFINE LCD_DATAUS 50 'Data delay time in us

    TRISC = %00000000 'Set port B as output
    TRISB = %00000000 'Set port D as output
    low PORTB.6 'Set the R/W bit to low

    pause 1000 'wait until the LCD initializes

    ' Define program variables
    col var byte ' Keypad column
    row var byte ' Keypad row
    key var byte ' Key value
    Value var byte
    ADCON1 = 7 ' Make PORTA and PORTE digital


    Pause 100 ' Wait for LCD to start

    Lcdout $fe, 1, "Key In Bus ID" ' Display sign on message

    loop:
    Gosub getkey ' Get a key from the keypad
    Lcdout $FE, $C0, "BUS",DEC2 key ' Display ASCII key number
    PAUSE 200
    Goto loop ' Do it forever

    ' Subroutine to get a key from keypad
    getkey:
    Pause 50 ' Debounce

    getkeyu:
    ' Wait for all keys up
    PORTD = 0 ' All output pins low
    TRISD = $f0 ' Bottom 4 pins out, top 4 pins in
    If ((PORTD >> 4) != $f) Then getkeyu ' If any keys down, loop
    Pause 50 ' Debounce
    getkeyp:
    ' Wait for keypress
    For col = 0 to 3 ' 4 columns in keypad
    PORTD = 0 ' All output pins low
    TRISD = (dcd col) ^ $ff ' Set one column pin to output
    row = PORTD >> 4 ' Read row
    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))
    Return ' Subroutine over
    end
     
  2. sswcharlie

    New Member

    Sep 11, 2008
    3
    0
    Hi

    Was anyone able to come up with an answer for this project.

    I want to do the same thing.

    Charlie
     
Loading...