Rs-232
Lightfoot
Posts: 228
I set up a circuit that has a 22000 ohm resistor between the TXD pin and ra.0 of an SX chip. I wrote this program to capture an 8 bit signal from the computer's serial port.
How come the LED's do not light up in accordence to the binary value sent? The transmitter is a computer using visual basic.NET to send the signal.
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Well well, I'm seeing things, three of them.
-Stanley Blystone
DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX FREQ 4_000_000 PROGRAM Start tris_b = 0 sdata var byte Start: DO SERIN RA.1, N2400, sData rb = sData LOOP
How come the LED's do not light up in accordence to the binary value sent? The transmitter is a computer using visual basic.NET to send the signal.
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Well well, I'm seeing things, three of them.
-Stanley Blystone
Comments
Change OSC4MHZ to OSCXT1 and use a 4MHz resonator.
Also your "tris_b·=·0" will never get executed, because execution starts at the label "Start:".
You can simplify your program by just using "SERIN RA.1, N2400, RB".
I also recommend using the BORxx option on the DEVICE line. This prevents start-up problems.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
There are only two guaranteed ways to become weathy.
Spend less than you make.
Make more than you spend.
Post Edited (Bean (Hitt Consulting)) : 9/1/2006 12:17:15 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Well well, I'm seeing things, three of them.
-Stanley Blystone
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
There are only two guaranteed ways to become weathy.
Spend less than you make.
Make more than you spend.
·
Just too much drift.
If you want to use the interanl oscillar, synchronous serial will work in some cases.{shift in, shift out, SPI, I2C}
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"If you want more fiber, eat the package.· Not enough?· Eat the manual."········
In theory, the IRC could be calibrated to within 1.5% of 4 MHz.· I don't know how accurate the calibration procedure is, and I normally specify "IRC_CAL IRC_FAST", which sets the trim bits to all ones for the highest frequency trim.· I then run my own calibration program where I toggle an LED every 10 seconds and measure the frequency using a stop watch.· A second parameter can be used with the FREQ directive to indicate the actual frequency of the clock.· In my case I have an SX chip that runs at 4.48 MHz, so I would use the following directives for this chip:
IRC_CAL·· IRC_FAST
FREQ······ 4_000_000 4_480_000
The other problem with the IRC is thermal drift.· The SX manual says that the IRC has a tolerance of +/- 8% over the thermal operating range.· If I read the manual correctly, the themal operating range is -40 degrees C to 85 degrees C.· This is -40 degrees fahrenheit to 185 degrees fahrenheit.· This is a 225 degree range.· The normal range in a household or office environment would be one-tenth of this, so I would expect the frequency drift to be more like 1% to 2% in a normal setting.
The bottom line is that serial communications can work with the internal RC oscillator.· I run this way all the time, and I haven't seen any problems.· However, in a less controlled enviroment, or when·tighter tolerances are required a resonator or crystal oscillator should be used.
Dave