PDA

View Full Version : Serout PIC16F628 to PC R18iXL Board



Spindle
- 18th June 2005, 23:11
Hey guys and girls,

I am trying to just print a string to the serial communicator in Microcode Studio. I purchased the Rapid18iXL board built from hobbyengineering.com but the company who makes them is www.dhmicro.com. This board has RS232 support. The documentation on it can be found... http://www.dhmicro.com/PDFs/Manual/Rapid18iXL_Man.pdf and http://www.dhmicro.com/PDFs/Appnote/AN02_232_SQ1_R18XL.pdf I have searched the forums for everything I could find on the serout command and I think my code is correct and its some hardware issue. Maybe my jumper configuration is wrong on the board? I am using a PIC16F628 microchip and BPB and the Epic Programmer. Here is my code..

@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT ' system clock options
@ DEVICE pic16F628, WDT_ON ' watchdog timer
@ DEVICE pic16F628, PWRT_ON ' power-on timer
@ DEVICE pic16F628, MCLR_OFF ' master clear options (internal)
@ DEVICE pic16F628, BOD_ON ' brown-out detect
@ DEVICE pic16F628, LVP_OFF ' low-voltage programming
@ DEVICE pic16F628, CPD_OFF ' data memory code Protect
@ DEVICE pic16F628, PROTECT_OFF ' program code protection

include "modedefs.bas"
define OSC 20

CMCON = 7
TRISB.0 = 0
PORTB.0 = 0

print:
Serout PORTB.0, N2400, ["gaby"] ' Send string
pause 100 ' pause 1/10 sec
Goto print ' Forever

end


All I got is a bunch of garbage on the serial communicator screen. I have tried all sorts of baud rates ture and inverted. On the board I have a wire going from RB0 to TxD and that's it. I am not sure what RTS or CTS is but do not think it's needed. There is also RxD but that is for recieving data. I have literally been working at this for the last 5 hours. Any help is greatly appreciated!

Thanks,
Matthew

mister_e
- 19th June 2005, 00:07
the internal; oscillator is 4MHZ, by using the DEFINE OSC 20 you tell to PBP to use a 20MHZ oscillator... remove that line and you should be in business. depending if you're using the MAX232, use true mode T2400 in your SEROUT.

Spindle
- 19th June 2005, 00:29
Thanks a lot mister_e it works. So I use True because of the MAX232 chip and it inverts it? The reason I put Define OSC 20 is because my chip is a 16F628-20/P so I assumed the internal clock was at 20mhz! Thanks for the simple fix!

Matthew