PDA

View Full Version : Asynchronous baud rates on a 12F683 (serin / serout)



johnrem
- 14th September 2015, 16:17
Greetings all:

Is there a maximum baud rate for serin/serout on the 12F683? I'm trying to port code from another device at T9600 and can't get the 12F683 to pic up the data on serin. I'm thinking maybe this chip is too slow?

Thanks for any and all ideas . . .

Archangel
- 14th September 2015, 17:22
show us your code

either include"modedefs.bas" or use mode 2 for t9600 driven as per manual 5.79.

sometimes int_osc is too slow or inaccurate for "fast" serout. Be sure to DEFINE OSC xx so PBP knows what you are doing.

johnrem
- 14th September 2015, 18:05
I've tried all kinds of different fuses and serin lines, here the latest . . .

DEFINE osccon_1k 1 ' 4 ' 4mhz
ANSEL = %00000000 ' all pins digital
Include "modedefs.bas"
osccon = %01100000
B0 var byte
B1 var byte
b10 var byte
main:
SERIN 1, T9600, 10, main, [$65],b1,b0

I've dropped the timout, dropped the qualifier, changes the fuse, all to no avail. My latest strategy is to try a 16F688.

Archangel
- 15th September 2015, 01:36
Ok,
I see some "minor details"
Var names must generally match B0 != b0

You used 1 for the pin name, I don't use that as it confuses me, I use GPIO.1

Defines must be caps, Define OSCCON_1K, define OSC 4 (notice I did NOT Capitalize the word define (no matter) but OSC IS CAPITALIZED.


DEFINE OSC 4
DEFINE OSCCON_1k 1 ' 4 ' 4mhz
ANSEL = %00000000 ' all pins digital
Include "modedefs.bas"
OSCCON = %01100000
B0 var byte
B1 var byte
B10 var byte
main:
SERIN GPIO.1, T9600, 10, main, [$65],B1,B0
End

You might find the debug command is faster, and more compact than any of the other "software" serial commands.