Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

code convertion 16F628 -> 16F84

Status
Not open for further replies.

patroclus

New Member
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!
 
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 said:
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.
 
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...
 
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?
 
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!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top