Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 22nd February 2008, 08:43 AM   #1
Default Firefly 16F88 RS232 problem

I've written code to send text from the Firefly to my PC using the AUSART. First odd thing I noticed was that it worked fine when run slow in the debugger, but sent nothing when run at full speed.

I finally found that if I put a short delay right after setting SPBRG during the init, it works normally. I've never had to do this before. Is it something specific to the Firefly or the 16F88, or have I just been lucky up to now with 16F's?

__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 22nd February 2008 at 08:50 AM.
futz is offline  
Old 22nd February 2008, 09:44 AM   #2
Default

Are you using the INTOSC? If so, this is a symptom I've seen on several different PIC devices including the 16F88.

On my 16F88 boot-loader I actually include an additional delay after testing the oscillator stable flag before using the UART.

Mike
Mike, K8LH is offline  
Old 22nd February 2008, 04:29 PM   #3
Default

Quote:
Originally Posted by Mike, K8LH
Are you using the INTOSC? If so, this is a symptom I've seen on several different PIC devices including the 16F88.

On my 16F88 boot-loader I actually include an additional delay after testing the oscillator stable flag before using the UART.

Mike
Hey! That could be it. I am using internal osc. The program is tiny and gets right to business doing the one thing it does - spit data out the RS232. I'll take out the delay and put a osc-stable check and see what happens.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is offline  
Old 23rd February 2008, 02:54 AM   #4
Default

Yup, that cured it. No delay needed. Just a quicky little oscillator-stable loop, waiting for the IOFS bit to get set.
Code:
init
	banksel	OSCCON		;bank 1
	movlw	b'01110110'	;internal 8mhz osc
	movwf	OSCCON
stable	btfss	OSCCON,IOFS	;oscillator stable?
	goto	stable		;no, wait
	.
	.
	.
I guess I must have always used crystals before, and they start up faster, or I had bigger code that did other things while the osc stabilized.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is offline  
Old 23rd February 2008, 03:19 AM   #5
Default

I wonder if that applies to all PICs with an IOFS bit. Good thing to know.
Nice photos too futz
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com/
blueroomelectronics is offline  
Old 23rd February 2008, 04:23 AM   #6
Default

Quote:
Originally Posted by blueroomelectronics
Nice photos too futz
Playing with my nice new Canon A650 IS. Costco just recently had them on sale for $100 off, so I grabbed one. All previous pics came from my Canon A80.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 23rd February 2008 at 04:43 AM.
futz is offline  
Old 23rd February 2008, 01:04 PM   #7
Default

Quote:
Originally Posted by blueroomelectronics
I wonder if that applies to all PICs with an IOFS bit. Good thing to know.
I experienced the same symptom when using INTOSC on my 18F2520 and 18F2620 bootloaders too. It seems to take just a tiny bit longer than "oscillator stable" for the oscillator to be "on frequency"...

Mike
Mike, K8LH is offline  
Reply

Tags
16f88, firefly, problem, rs232

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
JDM programmer problem krvavizmaj Micro Controllers 17 6th August 2009 01:24 AM
USB to RS232 Converter VictorPS General Electronics Chat 7 16th June 2007 04:59 AM
Strange problem tkvenki Micro Controllers 1 3rd May 2007 12:40 PM
I²C and RS232 on the same PIC l30 Micro Controllers 2 3rd July 2004 04:14 AM
Creative live 5.1 problem... nassus General Electronics Chat 9 10th June 2004 06:51 AM



All times are GMT. The time now is 11:05 PM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker