Hi Joe
Been battling with this even more now... have read up on the registers
Still, no go JOE :-)
Here's the code
receiver 16f690
Transmitter is 184520 (which receiver and sends perfectly well with hserin/out) working it as the transmitter is the problem I have :-( same as for a6F690Code:'16F690 DEMO DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz OSCCON=%01110000 ' DEFINE OSC 4 'This is the default setting ' OSCCON=%01100000 ADCON0 = 0 ADCON1=0 ANSEL = 0 ANSELH = 0 CM1CON0 = 0 CM2CON0 = 0 'RCSTA = %10010000 'txsta=%10100000 'rcsta=%10010000 RCSTA = $90 ' Enable serial port & continuous receive TXSTA = $20 ' Enable transmit, BRGH = 0 SPBRG = 25 ' 2400 Baud @ 4MHz, 0.17% DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0 DEFINE HSER_SPBRG 25 ' 2400 Baud @ 4MHz, 0.17% DEFINE HSER_CLROERR 1 ' Clear overflow automatically 'The first line is if you are using PM, the second if you are using MPASAM ' @ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off ' @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF TRISA = %00000000 'example only - TRISB = %00001111 ;Make B4-B7 outputs, B0-B3 inputs, TRISB = %00100000 'TX=PORTB.7 RX=PORTB.5 TRISC = %00000000 '0 will make the pins an output, 1 will make them inputs 'includes begin here INCLUDE "modedefs.bas" include "c:\pbp\samples\keypad.bas" 'end of includes TRAIN VAR BYTE train = $B3 SYNK VAR BYTE SYNK = $7E XNUM VAR BYTE YNUM VAR BYTE ZNUM VAR BYTE LED var PORTC.0 'Variables end here loopy: low LED ' LED on hserin [WAIT(SYNK),XNUM,YNUM,ZNUM] ' and now out to hyperterminal (or wherever!) hserout["X-",DEC XNUM," Y-",DEC YNUM," Z-",DEC ZNUM,$d,$a] 'to hyperterminal toggle led Goto loopy ' Go back to loop and blink LED forever End 'End of all code
Keep well JoeCode:'USART defines and register settings begin here - use for HSERIN/OUT '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 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 TRISC = %10010000 XNUM VAR BYTE YNUM VAR BYTE ZNUM VAR BYTE TRAIN VAR BYTE train = $B3 WNUM = 225 XNUM = 31 YNUM = 100 ZNUM = 4 hserin [WAIT(SYNK),XNUM,YNUM,ZNUM]
Kind regards
Dennis




Bookmarks