Hello all,
I have been searching for a solution to this problem and found some answers that sounded promising but ended up not doing the trick.
As some others have posted - I too am having trouble with the serout timing of the 12f683. I'm sending to a MAX232 and receiving with a PC running serial terminal. If I use a 16F877A it works fine, so I think the MAX is OK. Some Hex characters (below $08 and above $FC) work fine, but the ones in between are not the correct code. For instance I send $13 and the receiver gets $35. The data seems very consistent, just mostly wrong. I would prefer to not use the external resonator (behavior is the same using the internal 8MHZ clock (with OSCCON %01110000), but I wanted to try an external resonator to just to see if it would help - it did not.), but this code shows it with a external resonator.
I have seen in some of the other posts about tuning the ocillator, that doesn't seem to help. I tried varying the baud around 396 (I'm doing 2400 baud - driven true), no help.Code:Include "modedefs.bas" ' Mode definitions for Serout ' Define ADCIN parameters Define ADC_BITS 8 ' Set number of bits in result Define ADC_CLOCK 3 ' Set clock source (3=rc) Define ADC_SAMPLEUS 200 ' Set sampling time in uS 'config_hs_osc 'do I need this? define osc 8 ANSEL =%00110100 ' Set Internal clock, Set AN2 analog, rest digital CMCON0 =%00000111 'analog comparator off ADCON0 =%10001001 'right justify, channel 2 analog, a/d converter on OSCCON =%01111001 '8 mhz external resonator OSCTUNE=%00000000 'varied between %00000011 and %00011100 no help adval var byte ' Create adval to store result loop: ADCIN 2, adval ' Read channel 2 to adval pause 500 serout2 GPIO.0, 396, [$13] 'receiver is seeing $35 serout GPIO.0, T2400, [$13] 'same thing Goto loop ' Do it forever End
I think it's a timing issue, but I don't know what else to change, any ideas?
Thanks!



and besides, I cannot even see my bench right now, I don't want to get too rusty.


Bookmarks