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.

convert from 16c84 to 16f628a need help

Jaison

New Member
converter de 16c84 para 16f628a preciso de ajuda

eu tenho o programa 16c84 e quero converter este programa 16f628a preciso de ajuda para fazer isso.
 

Attachments

  • rtp2022.asm
    57.8 KB · Views: 72

Jaison

New Member
Hello Mr. Nigel good afternoon, I would like to thank you for your kindness in helping and answering my question, my programming knowledge is weak, I am an Amateur Radio in Brazil and I would like to make this program work for our local VHF repeater. I made some changes and put several ***** (asterisks) in the lines I changed, but I don't know if they are correct.
Thanks again Jason - PP5MEL
 

Attachments

  • rptr0422_03.asm
    58.2 KB · Views: 73

Pommie

Well-Known Member
Most Helpful Member
I had a quick look at your file and the only thing that stands out is the interrupt must be at location 4 - you've changed it to 0x100 (actually, might be 100 decimal). And, w_copy needs to be in common SFR area (0x70+), also, the push macro isn't clearing RP0 - it may be in bank 1 when it enters the interrupt.

Mike.
 

Jaison

New Member
Dear good afternoon, I made these changes I don't know if they are correct, I'll try to run it in MPLab tonight.
Again I appreciate everyone's help and if any friend can hit the program I left it wrong please help me, feel free and change what is necessary and repost here, I will be eternally grateful. Jason - PP5MEL.
 

Attachments

  • rptr0422_04.asm
    58.2 KB · Views: 58

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
You put the CMCON in the wrong place... This forces relocatable code..

You need to place it directly after the "start" label
Code:
start
        banksel CMCON
        movlw    0x07        ;************ADICIONADO turn off comparators
        movwf    CMCON       ; ***********ADICIONADO
 

augustinetez

Active Member
This file will compile to the 16F628A.

There are only 2 changes needed to the original file besides setting the 16F628A inc and processor and I have marked them with ;----------------------------------
 

Attachments

  • rtp2022_628.asm
    58.2 KB · Views: 65

Pommie

Well-Known Member
Most Helpful Member
The bcf STATUS,RP0 needs to be moved to after STATUS is saved or it'll always return in bank 0. Also, w_copy (and s_copy) needs to be in the common area in case it's in bank 1 when the ISR happens, actually, it'll still work as the bank is restored before w_copy so it'll just be saved in whatever bank it happens to be in - this wasn't needed on the 84 as all memory was common.

Mike.
Actually, it won't work as STATUS will always be restored from bank 0.
 
Last edited:

augustinetez

Active Member
Too early in the morning - not enough coffee :)
I used the 16F628 datasheet example (I know, probably a mistake).
Code:
MOVWF W_TEMP ;copy W to temp register,
;could be in any bank
SWAPF STATUS,W ;swap status to be saved
;into W
BCF STATUS,RP0 ;change to bank 0
;regardless of current
;bank
MOVWF STATUS_TEMP ;save status to bank 0
;register
:
:(ISR)
:
SWAPF STATUS_TEMP,W;swap STATUS_TEMP
register
;into W, sets bank to
original
;state
MOVWF STATUS ;move W into STATUS
;register
SWAPF W_TEMP,F ;swap W_TEMP
SWAPF W_TEMP,W ;swap W_TEMP into W

Updated file
 

Attachments

  • rtp2022_628_1.asm
    58.2 KB · Views: 63

Jaison

New Member
Caro boa noite, obrigado mais uma vez, compilei via Mplab, compilei mas não faz as ações na placa, preciso alterar algo nos fusíveis? Estou bem perdido.
 

Attachments

  • RPT.ZIP
    657.2 KB · Views: 64
Last edited:

augustinetez

Active Member
The repeater controller is from QST magazine February 1997.

If the original software worked, there isn't anything different in the updated file that would stop it working that I can think of but I will double check the Config word to make sure.

repeater_controller.jpg
 

augustinetez

Active Member
I've updated the file with a new Config setting just in case the MCLR setting was causing a problem (it should default to ON).

Edit - changed Config for XT_OSC
 

Attachments

  • rtp2022_628_2.asm
    58.3 KB · Views: 56
Last edited:

Pommie

Well-Known Member
Most Helpful Member
I'm out atm so can't check but think I remember the oscillator as being xt. Might be worth checking.

Mike.
 

upand_at_them

Active Member
I haven't looked at the code, but the General Purpose Registers (user program variables) start at 0x0C on the 16F84 and start at 0x20 on the 16F628A. Has that be fixed, if necessary?
 

Pommie

Well-Known Member
Most Helpful Member
Yep it was XT - updated the file in post #15
File still reads _XT_OSC. Shouldn't it be _EC_OSC not _XT_OSC? I.E. I/O on OSC2 (RA6) and clock in on OSC1 (RA7) as per the schematic above. I've never used an external clock so not sure about this. What is in the original file? Just checked, the 84 didn't have the EC option so not sure how this will work.

Mike.
 

augustinetez

Active Member
The OP's original file was XT and the file from the QST file library (original original) is XT (I had put HS in the file), maybe the 16F628 doesn't like being fed an external signal whil;e in XT mode..

Jaison, replace the Config file in rtp2022_628_2.asm with this one if it still doesn't work as per Pommie's suggestion and see if that makes a difference.

__config _CP_OFF&_LVP_OFF&_BODEN_OFF&_MCLRE_ON&_PWRTE_ON&_WDT_OFF&_EXTCLK_OSC
 

Latest threads

New Articles From Microcontroller Tips

Top