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.

programming 16c84's asm/hex into 16f84a

Status
Not open for further replies.

raymondk

New Member
I am recently building an propeller led clock using Bobblick's website's idea.

I got an 16f84a and programmed it with an 16c84 hex .

however, the 16f84a doesn't work

It's on, but the output pin didn't move on to next bit change.

What should I do on this? [ plx help~~!!!

I attached the asm here
I changed the include file from 16c84.inc to 16f84a.inc, but still didn't work things out
 

Attachments

  • mclock8.asm
    9.8 KB · Views: 185
There are setup differences. The 84A has additional fuctions that the original 84 doesn't have. Look at the 84A datasheet. I'll look at the program when I get home. And I'll suggest the changes thst you need to make.
 
There used to be a migration document at MicroChip that tells you what you need to change, it's fairly minimal - but as the chip was obselete 15 odd years ago, the document doesn't seem to be there any more - I might have it at home somewhere though.
 
So Ian, all you had to do was add in BANKSEL for the appropriate registers to convert from 16C84 to 16F84A?
 
Last edited:
And remove the tris and option statements You now must movwf -> trisa or b and movwf -> option_reg, hence the bank selection

As far as I'm aware the option and tris statements still work perfectly on the 16F84a, and even on far, far more modern devices as well - however, it's been recommended not to use it for a LONG, LONG time (including on the 16C84). MicroChip have long stated it's not supported, and 'may' be removed from later devices - but they still worked last time I tried.

So I wouldn't have thought it would have made any difference?.
 
I run it on ISIS.. the command " movlw b'011111000 " then " option " did nothing to the option reg.... the problem was in inclusion of the "p16f84a.inc". The rest was just to modernise the code.

Probably a problem with ISIS then?, I can see they might not bother implementing the instruction as it's advised not to use it.

I must say though, I haven't used either option or tris since well back in the 20th century - but the code assembles fine.
 
There wasn't a problem..... "option" was not defined in the new ".inc" file, it was "option_reg" that need to be defined.... point is it works now.. I just put in the banksel because that is what we do now.
 
There wasn't a problem..... "option" was not defined in the new ".inc" file, it was "option_reg" that need to be defined.... point is it works now.. I just put in the banksel because that is what we do now.

Good point - if you were trying to write to the option register, it was indeed renamed later on - but the 'option' in the original source was an instruction, not a reference to the .INC file.

I wasn't aware though that the OP wasn't able to assemble the file, just that it didn't work. The original file assembles fine for me, with no modifications at all - no idea if it works or not though?.

I've not been able to find the migration document, I suspect it's two many backups away :D
 
From what I have read there really no migration the only big thing was the OSC the 16c84 is 10 mhz max and 16f84a is 20 mhz max the new Mplab has a lot of name changes that make older code not build .
 
From what I have read there really no migration the only big thing was the OSC the 16c84 is 10 mhz max and 16f84a is 20 mhz max the new Mplab has a lot of name changes that make older code not build .

You're perhaps thinking of the migration document from F84 to F84a (which I do still have), the 84a was just a 'later silicon revision' not really any big difference, the change from the C84 to the F84 was to cure the security bug it had.
 

Attachments

  • 16f84_to_84A.pdf
    115.9 KB · Views: 249
Last edited:
thx everyone~

I tried ian's asm , the chip is not running....

but it did turn the warning things becoming message( I am using MPLAB )

I think The Inc problem you guys mentions is right
But what can i do /_\

Here is the original asm


Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "mclock8.asm" /l"mclock8.lst" /e"mclock8.err" /d__DEBUG=1
Warning[224] C:\USERS\KOO\DESKTOP\LED\LED_CLOCK\CODE1\MCLOCK8.ASM 131 : Use of this instruction is not recommended.
Warning[224] C:\USERS\KOO\DESKTOP\LED\LED_CLOCK\CODE1\MCLOCK8.ASM 135 : Use of this instruction is not recommended.
Warning[224] C:\USERS\KOO\DESKTOP\LED\LED_CLOCK\CODE1\MCLOCK8.ASM 146 : Use of this instruction is not recommended.
Message[305] C:\USERS\KOO\DESKTOP\LED\LED_CLOCK\CODE1\MCLOCK8.ASM 173 : Using default destination of 1 (file).
Message[305] C:\USERS\KOO\DESKTOP\LED\LED_CLOCK\CODE1\MCLOCK8.ASM 177 : Using default destination of 1 (file).
Message[305] C:\USERS\KOO\DESKTOP\LED\LED_CLOCK\CODE1\MCLOCK8.ASM 248 : Using default destination of 1 (file).
Message[305] C:\USERS\KOO\DESKTOP\LED\LED_CLOCK\CODE1\MCLOCK8.ASM 263 : Using default destination of 1 (file).
Message[305] C:\USERS\KOO\DESKTOP\LED\LED_CLOCK\CODE1\MCLOCK8.ASM 294 : Using default destination of 1 (file).


Here is Ian's asm

Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "mclock8.asm" /l"mclock8.lst" /e"mclock8.err" /d__DEBUG=1
Message[302] C:\USERS\KOO\DESKTOP\PROPELLER CLOCK\MCLOCK8.ASM 134 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\USERS\KOO\DESKTOP\PROPELLER CLOCK\MCLOCK8.ASM 138 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\USERS\KOO\DESKTOP\PROPELLER CLOCK\MCLOCK8.ASM 151 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[305] C:\USERS\KOO\DESKTOP\PROPELLER CLOCK\MCLOCK8.ASM 179 : Using default destination of 1 (file).
Message[305] C:\USERS\KOO\DESKTOP\PROPELLER CLOCK\MCLOCK8.ASM 183 : Using default destination of 1 (file).
Message[305] C:\USERS\KOO\DESKTOP\PROPELLER CLOCK\MCLOCK8.ASM 254 : Using default destination of 1 (file).
Message[305] C:\USERS\KOO\DESKTOP\PROPELLER CLOCK\MCLOCK8.ASM 269 : Using default destination of 1 (file).
Message[305] C:\USERS\KOO\DESKTOP\PROPELLER CLOCK\MCLOCK8.ASM 300 : Using default destination of 1 (file).
 
Raymondk.. No errors with mpasmwin on my machine... runs in ISIS no problem. What's not working?

I build this according to this website

**broken link removed**

assuming the programming problem was solved

I found that if i put resistors in Ra4 or MCLR, the chip stops running
if i pull them away, the chip runs normal, but the outpin voltage is so low , it just can't drive the led
 
Raymondk.. No errors with mpasmwin on my machine... runs in ISIS no problem. What's not working?

He had no errors either, just warnings - perhaps he has a hardware problem preventing the circuit working?.

However, I would check on the 305 warnings, in case the deault setting isn't correct - it's always a good idea to add the w or f at the end of the instruction.
 
Raymondk.. No errors with mpasmwin on my machine... runs in ISIS no problem. What's not working?

assuming the programming works fine

there are still problems,

The schematic i am following is the website
**broken link removed**

1. if i put resistor in ra4/mclr, the chip stops running
2. if i didn't put resistor in ra4 /mclr, the output pin voltage was fixed, y?
 
assuming the programming works fine

there are still some problems

**broken link removed**
this is the schematic i am following

1. if i put resistors in ra4/mclr, the output pin voltage level got fixed at 5v
2. even if i put them out, the voltage level at led still got fixed at about 3V

the chip work fine(the output pin keep jumping) only when there is no resistor and led =_=
 
Last edited:
The resistor on MCLR is absolutely essential, it won't work without it - you may be experiencing random resets if you remove it, which could explain your 'jumping'.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top