Hi Dave :-)
As reagrds the 93 compiler picked that one up :-)
So your code-eyes are working!!
I have still have that small problem somewhere and can't quite figure out where :-( the 93 issue
It seems like HSERIN is happy to pass the number 9 into the variable as well, even though thats the number it's supposed to wait for !
Think it's somewhere in the HSERIN/OUT lines ... and I don't think I can move on to the radio portion unless I find the problem :-(
Do you think you could please cast your 'code eyes' over my code please.
Here's the Transmitter code
Code:'************************************* '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 myvar var byte datatx var byte datarx var byte net var byte 'end of variables 'USART defines and register settings begin here - use for HSERIN/OUT RCSTA = $90 ' Enable serial port & continuous receive TXSTA = $20 ' Enable transmit, BRGH = 0 SPBRG = 51 ' 2400 Baud @ 8MHz, 0.17% DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0 DEFINE HSER_SPBRG 51 ' 2400 Baud @ 8MHz, 0.17% DEFINE HSER_CLROERR 1 ' Clear overflow automatically ' Check port settings PORTC.6 = TX and PORTC.7 = RX ' For PIC to PIC TX to RX C.6 to C.7 and visa versa ' Don't forget TRISC=%10000000 'USART defines and register settings end here 'main code begins here LED var PORTd.0 ' Alias PORTD.0 to LED loopy: high LED ' LED on Pause 1000 ' Delay for 1 seconds 'HSER starts here HSERout ["9",DEC 3,$d,$a] 'HSERIN [WAIT("9"),DEC NET] << this is the format for the receiver 'HSER ends here low led 'LED off Pause 1000 ' Delay for 1 seconds Goto loopy ' Go back to loop and blink LED forever End 'End of all code
Here's the receiver code
As regards the RF modules...Code:'************************************************** RX from anywhere display on LCD and TX to wherever (PIC 18F4520) '*************************************************** '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 A0 var byte myvar var byte datatx var byte datarx var byte net var byte led var PORTD.0 'end of variables 'LCD defines begin here DEFINE LCD_BITS 4 'defines the number of data interface lines (4 or 8) DEFINE LCD_DREG PORTD 'defines the port where data lines are connected to DEFINE LCD_DBIT 4 'defines the position of data lines for 4-bit interface (0 or 4) DEFINE LCD_RSREG PORTD 'defines the port where RS line is connected to DEFINE LCD_RSBIT 2 'defines the pin where RS line is connected to DEFINE LCD_EREG PORTD 'defines the port where E line is connected to DEFINE LCD_EBIT 3 'defines the pin where E line is connected 'DEFINE LCD_RWREG 0 'defines the port where R/W line is connected to (set to 0 if not used) 'DEFINE LCD_RWBIT 0 'defines the pin where R/W line is connected to (set to 0 if not used) DEFINE LCD_COMMANDUS 2000 'defines the delay after LCDOUT statement DEFINE LCD_DATAUS 200 'delay in micro seconds 'END of LCD DEFINES 'includes begin here INCLUDE "modedefs.bas" include "c:\pbp\samples\keypad.bas" 'end of includes 'USART defines and register settings begin here - use for HSERIN/OUT RCSTA = $90 ' Enable serial port & continuous receive TXSTA = $20 ' Enable transmit, BRGH = 0 SPBRG = 207 ' 2400 Baud @ 32MHz, 0.17% DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0 DEFINE HSER_SPBRG 207 ' 2400 Baud @ 32MHz, 0.17% DEFINE HSER_CLROERR 1 ' Clear overflow automatically ' Check port settings PORTC.6 = TX and PORTC.7 = RX ' For PIC to PIC TX to RX C.6 to C.7 and visa versa ' Don't forget TRISC=%10000000 'USART defines and register settings end here 'Main code begins here Pause 2000 ' Wait for LCD to startup test: high LED 'HSER starts here -change or comment these for desired direction RX /TX HSERIN [WAIT("9"),DEC NET] '<< this is the format for the receiver or if ' HSERout "I Recived this number ",DEC NET,$d,$a 'HSER ends here lcdout $fe,1 lcdout "starting" lcdout $fe,1 lcdout "POSTTX hser is ", dec net 'show variable net colelcted by hserin a few lines up Pause 1000 Lcdout $fe,1 lcdout "rx complete" pause 1000 lcdout $fe,1 'clear lcd screen lcdout dec net 'display status of net variable pause 3000 IF net = 3 then lcdout $fe,1 LCDOUT "MATCH for ",dec net 'look for the number 3 and display MATCH string low LED pause 2000 endif lcdout $fe,1 lcdout "begin hserout to hyperterminal" 'show beginning of TX to PC com port pause 1000 LOOKUP net,[0,"123A456B789C*0#D"],net 'use lookup table to diplay proper display in hyperterminal 'serout PORTC.3,T2400,["the key pressed or received value is ",net,10,13] HSERout ["I Recived this number ",DEC NET,$d,$a] 'net var value should show in hyperterminal lcdout $fe,1 lcdout "transmission complete" pause 1000 goto test end
I have the TWS and RWS ones from Rentron and I have some from Telecontrolli namely the RT5 and RRS3
Not sure what you are referring to about the davehouston site ?? What exactly should I be looking at ?
I have communicated with Dave because I was trying to get his TX/RX (which uses pulsein and debug) solution implemented in my project but it seems I can't read the correct pules .. still don't know why :-(
Kind regards
Dennis




Bookmarks