Hi Dave :-)
How are you ?
Well the lines you gave me work on the wire ..just like before...so I decided to try the TX/RX RF pair TLP-434 and RLP-434 from Bruce at Rentron.
And .... it works ...kinda :-)
Instead of seeing the number 3 (DEC 3) it shows me the number 2 (DEC 2) in MCS serial terminal window.
oh and it also seems to bypass the if NET=3 statement/test for some reason ..I don't think it ever 'sees' a 3 coming in.
So now I'm wondering where I have gone wrong :-(
Here's my receiver code :
Code:
'*************************************
'Keypress display on LCD and TX to wherever
'*************************************
'Ocsillator selections here
'DEFINE OSC 8
'OSCCON=%01110000
'or
'DEFINE OSC 4
'OSCCON=%01100000
'OSCTUNE.6 = 0 'PLL Multiplier disabled
'OSCTUNE.6 = 1 'PLL 4x
'Ocsillator selections here
OSCCON = $70 'Int CLK 8MHz
OSCTUNE.6 = 1 'PLL 4x
ADCON1= %00001111 '$0F = disable A/D converter
cmcon = 7
INTCON2.7 = 0 'switch pull-ups ON
'END of oscillator selections
'timer/oscillator defines
DEFINE OSC 32 '4x 8MHz
'END of timer/oscillator defines
'Port IO directions and presets for port pins begin here
'TRISX = %76543210 << tris bit order numbering
'TRISA = %11111111 'All pins are inputs
'// Define port pins as inputs and outputs ...
TRISA = %00000000 'example only - TRISB = %00001111 ;Make B4-B7 outputs, B0-B3 inputs,
TRISB = %11111111 'for 4x4 keypad all input
TRISC = %10010000
TRISD = %00000000
TRISE.0 = 0
TRISE.1 = 0
TRISE.2 = 0
'End of Port IO directions and presets for port pins begin here
'variables begin here
net var byte
led var PORTD.0
'end of variables
'includes begin here
INCLUDE "modedefs.bas"
include "c:\pbp\samples\keypad.bas"
'end of includes
main:
high LED
'RF SERIN line here
SERIN PORTC.4,T2400,[9],net
serout PORTC.3,T2400,["the key pressed or received value is ",net,10,13]
low led
IF net = 3 then
low LED
serout PORTC.3,T2400,["the key pressed or received value is ", net,10,13]
pause 100
endif
'LOOKUP net,[0,"123A456B789C*0#D"],net 'use lookup table to diplay proper display in hyperterminal
'************************SEROUT TO HYPERTERMINAL
goto main
end
and the transmitter code
Code:
'*************************************
'16F887 Transmit to PIC 18f4520 serout loop
'*************************************
'@__config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
'Ocsillator selections here
'OSCCON = %01100001 for 4mhz, or OSCCON = %01110001for 8mhz
' OSCCON = %01110001 'Int CLK 8MHz
' ANSEL= %11111111 '$0F = disable A/D converter
' option_reg = 7 'switch pull-ups ON
'END of oscillator selections
'timer/oscillator defines
' define osc 8 '8MHz
'END of timer/oscillator defines
'clear the ports
OSCCON = %01110001 'Int CLK 8MHz
ANSEL = %00000000 'All digital
OPTION_REG.7 = 0 'Weak pull-ups enabled
DEFINE OSC 8 '8MHz
PORTA=0
PORTB=0
PORTC=0
PORTD=0
PORTE=0
'end of port clear
'Port IO directions and presets for port pins begin here
'TRISX = %76543210 << tris bit order numbering
'TRISA = %11111111 << 'All pins are outputs
'// Define port pins as inputs and outputs ...
TRISA = %00000000 'example only - TRISB = %00001111 ;Make B4-B7 outputs, B0-B3 inputs,
TRISB = %11111111 'for 4x4 keypad all input
TRISC = %10100000
TRISD = %00000000
TRISE.0 = 0
TRISE.1 = 0
TRISE.2 = 0
'End of Port IO directions and presets for port pins begin here
'includes begin here
INCLUDE "modedefs.bas"
include "c:\pbp\samples\keypad.bas"
'end of includes
'variables begin here
LED var PORTd.0 ' Alias PORTD.0 to LED
'RF variables
TRAIN VAR BYTE
TRAIN=$55
net var byte
'Variables end here
loopy:
high LED ' LED on
'for RF use the line below
SEROUT PORTC.4,T2400,[TRAIN,TRAIN,TRAIN,TRAIN,TRAIN,9,3]
low led
goto loopy
end
Any help would be greatly appreciated
Kind regards
Dennis
Bookmarks