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 6th April 2006, 06:18 PM   #1
Default code convertion 16F628 -> 16F84

Hello!

I finished a project using a 16F628, and now I need to conver the code to work on a 16F84 (the project does not use any of the exclusive capabilities of the 628).

I first got rid of

Code:
	MOVLW 0X07 ;Turn comparators off and
	MOVWF CMCON ;enable pins for I/O
Needed for the 16F628.
All RAM registers were defined between $20 and $2E, so should be fine for both pics... but it does not work! I don't uderstand why. 16F628 works great. 16F84 does not.
Both are using 8Mhz external crystal

any idea?
thank you!
patroclus is offline  
Old 6th April 2006, 07:22 PM   #2
Default

What about the fuse settings?, and what doesn't work?.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 6th April 2006, 08:17 PM   #3
Default

I'm not sure. The poject is quite complex.
It is an interface between two protocols (PS2 serial, and propietary protocol). It just does not work... I'd have to use a logic analyzer to see in detail, but I don't understand why a 16F84 does not work using same code as 16F628, when not using any of the extended capabilities (not internal oscilator, not extra i/o pins, no extra memory registers,...)

Just wondering if I missed something... but I can't see it now.
About the fuse settings, I'm not sure if you mean the configuration word. It is Ok i think. No watchdog..
patroclus is offline  
Old 6th April 2006, 08:35 PM   #4
Default

Quote:
Originally Posted by patroclus
I'm not sure. The poject is quite complex.
It is an interface between two protocols (PS2 serial, and propietary protocol). It just does not work... I'd have to use a logic analyzer to see in detail, but I don't understand why a 16F84 does not work using same code as 16F628, when not using any of the extended capabilities (not internal oscilator, not extra i/o pins, no extra memory registers,...)

Just wondering if I missed something... but I can't see it now.
About the fuse settings, I'm not sure if you mean the configuration word. It is Ok i think. No watchdog..
No good 'thinking' you have to 100% ABSOLUTELY SURE. The configuration word is often refered to as 'fuses' because the original OTP version actually blew fusible links to set them.

As it's 'quite complex' how large is the assembled machine code?, don't forget the 84 only has half the program memory of the 628.

Why are you wanting to do this anyway?, it seems a backward step?.

But essential the differences are:

Less memory (program, GPR's, and EEPROM).
GPR's start at a lower address.
Don't need the comparator disabling lines.
Configuration fuses are completely different.

It's VERY simple to change either way.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 6th April 2006, 08:43 PM   #5
Default

I'm sure configuration is fine. Watchdog disabled, and HS oscillator. The other settings code protection (off) and power up timer (off).

I just snipped with a logic analyzer, and I see that PIC doesn't even start (it is suppose to output a "starting up" sequence, that does not show up, so it doesn't even start running).

The program is less than $400 instructions, I know 16F628 has double this memory...
patroclus is offline  
Old 6th April 2006, 08:55 PM   #6
Default

This is just guesses, but it sounds like the 16F84 is not coming out of RESET. On the older parts there was a circuit attached to MCLR-bar that would produce a RESET. On the newer parts the PIC detects what is happening at the Vdd pin and performs the MCLR-bar function without using a pin for that purpose.

So tell me mein herr, ist pin 4 being used for der RA5 or der MCLR-bar?

You might also check too see if the oscillator is running. Can't execute if it can't clock.

Do both parts begin execution at Code Address 0x0000?
Papabravo is offline  
Old 6th April 2006, 09:35 PM   #7
Default

Finally got it. I don't really know what the problem was... maybe the reset, as I configured 16F628 to not use reset pin. Maybe I forgot that but I can't remeber as the circuit is in a protoboard. anyway, it surely was something stupid. Thank you for your help!
patroclus is offline  
Reply

Tags
>, 16f84, code, convertion

Thread Tools
Display Modes




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


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker