PDA

View Full Version : Migrate from 16F628 to 16F628A



cooksydesign
- 30th May 2006, 16:45
I'm using the following MeLabs products;

MeLabs programmer, rev. 3.3 with an EPIC Plus parallel programmer.

PIC Basic Pro compiler 2.46a. When compiling, command line reads PM Assembler 4.07. I type in pbp -p16f628a test

Programmer settings are as follows;
INTRC
Watchdog and PowerUp timers are enabled
MCLR is Input
Brownout is enabled
LVP is disabled

OPtions;
Reread file before programming is checked
Verify Target is checked
Program/code;
Verify; all options selected (checked)
Read; all options are selected (checked)
Blank Check; code checked
Erase; code/data/config/userID checked

Now then, program code is good, I have been using it in a 16F628 for quite a while. Moving to the 628A has had some issues. Program loads good, no errors. I can not transmit data out, SerOut PortB.4,["Test",13,10], on either PortB.4 or .5. I can see something being transmitted on the scope, but monitoring the data using Hyperterminal shows x and some RC/LF's.

I have read Appendix C in the 628A datasheet. I have scanned the forum, and PIC Lists. I'm not seeing anything like this.

Like I said, the code works in a 628. No serial out with 628A. Any suggestions, ideas,.. . . . much appreciated.

Brad

Melanie
- 30th May 2006, 17:26
There is no significant difference between a 628 and a 628A. Code for one will run without changes on the other.

However, any form of timing critical functions (such as SEROUT, SERIN etc) on INTERNAL OSCILLATOR is suspect. Just because it worked on a 628 (non-A) means you were lucky. If the world was flat, then you were sailing on the edge. Take a random sample of PICs, and some will have their Internal Oscillators spot on, and others will be off significantly to corrupt asynchronous data. Fit a Resonator or Xtal, switch to XT or HS Osc, and your troubles will disappear. Either that, or go buy a really big selection of PICs and outsort the ones that work...

I used to say, never go above 300 Baud on Internal Oscillator, but I've had batches of chips where even that wasn't reliable.

cooksydesign
- 30th May 2006, 19:34
I will attach an external resonator on the 628A in a few hours.

With all the programs I have writen using SerOut, I have never experienced this.

I'll let you know how it goes.

Many thanks.

Brad

Jerson
- 31st May 2006, 05:43
There is no significant difference between a 628 and a 628A.However, any form of timing critical functions (such as SEROUT, SERIN etc) on INTERNAL OSCILLATOR is suspect. Just because it worked on a 628 (non-A) means you were lucky. I used to say, never go above 300 Baud on Internal Oscillator, but I've had batches of chips where even that wasn't reliable.
Melanie

I do not quite understand your statements. I use the 628A on a regular basis with 9600 baud for SERIN2 and SEROUT2 with no problems till now. Can you please clarify if this is something to watch out for as a gotcha ??

Jerson

Melanie
- 31st May 2006, 07:13
But are you using it with the PIC set to INTERNAL OSCILLATOR?

Jerson
- 1st June 2006, 04:57
Melanie

Yes, I always use the internal osc. No problems yet.

Jerson

Melanie
- 1st June 2006, 07:07
Then you have been very lucky so far.

The Internal Oscillator is rarely on-frequency, it drifts with temperature and has the stability of a political manifesto at election time. The higher the baud rate, the greater the error margin. If you send or receive a short burst, the few bytes might be within spec, but thereafter you will drift out of specification and communication will be corrupted.

The rule is always to use a Resonator or Xtal when doing timing critical functions.

Jerson
- 1st June 2006, 09:21
Hi Melanie

Well, lucky perhaps. But, the most times, I have used the Serout / Serin functions as a handshake and they carry very little traffic. My products usually power off to a sleeping state which is around 90-95% of their working time. So, perhaps this is where I am lucky.

I can see your point about the internal oscillator drifting with time and temperature; and will keep it at the back of my mind for projects involving longer running times for serial communications.

Hey, btw : I like your analogy about the election manifesto. Looks like none of 'em politicians have reached me yet ;)

Cheers
Jerson

cooksydesign
- 1st June 2006, 15:15
Well, that worked. Thanks. I have to attach resonators to SSOP packages. Quite a few of them.

One more question, please;
The package type is a 16LF628A. Data sheet says it will operate at 2.5 volts. What do I need to do to get it to run on the low voltage? I have a 3 volt regulator in the circuit, and it does not run. At all. Even blinking a LED.

Thanks again.

B

Ingvar
- 1st June 2006, 15:38
Make sure brownout reset in not enabled.

cooksydesign
- 1st June 2006, 18:31
Thanks, disabling Brown-out Reset did the trick. I thought I had tried every combination to get the darn thing to run. Thanks.

Is it possible to use the 3v regulator when using the ICP? Presently I have to disconnect the 3v to the uC, connect 5v and burn the chip.

Otherwise, other than the mess I have soldering a resonator onto the SSOP, I'm in much better shape than I was 4 hours ago.

Brad