PDA

View Full Version : 12f629 serout,debug and serout2 timings



Dennis
- 10th January 2010, 03:13
Hi all

I am trying to use serin/out2 working sending a little text to the PC serial port.
I am using the MCS serial tool for viewing the data.
I am using a 12F629 (only because of its small footprint) , the PIC is set to use the internal oscillator running at 4MHz.
I am using a MAX232N (which works perfectly if I am using other PIC's for example the 18f4520 and the 16F887 ! with their internal oscillators set for use!)

I have not tried an external oscillator yet since I was hoping to avoid it.

I have tried various modes for serout serout2 and debug and all I ever see is variations of garbage in the serial tool screen on the PC :-(
I have scanned through the forums where others have had similar problems but unfortunately I have not arrived at a solution yet.

Has anyone had success with the 12F629's and serout,serout2 and debug?

I would really appreciate a few more suggestions as I may have missed something vital like a modifier or BAUD or MODE setting ?

Perhaps I should just use another PIC model ?

Please see my code below (it's very simple, just flashes an LED and sends some text to screen). The commented lines, they were just to test with.

Kind regards
Dennis


define OSC 4 '4MHz
'DEFINE OSCCAL_1K 1 ' Set OSCCAL for 1k
CMCON = 7
'TRISIO = %76543210 ' port5 is an output
TRISIO = %00000000 ' port5 is an output
'debug defines
' DEFINE DEBUG_REG GPIO
' DEFINE DEBUG_BIT 'GPIO.2
' DEFINE DEBUG_MODE 0 'Inverted
' DEFINE DEBUG_BAUD 9600
'debug defines end here

'variables begin here
Led1 var gpio.5
'end of variables

GPIO = 0 ' clear all outputs


'includes begin here
INCLUDE "modedefs.bas"
'end of includes

main:


high led1
pause 1000
serout GPIO.2,T1200,["the key pressed or received value is ",10,13]
'serout2 GPIO.2,T2400,["the key pressed or received value is ",10,13]

'Debug "hello world",10,13
low led1
pause 1000
goto main