![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
i happen to have a prooblem with my code. it seems like its very difficult to debug than to start a new program.
Can anyone help me find a problem with the code. i am not sure whether you will be able to understand the code if you can't please let me know. if you need it's intended operation just let me know. ;************************************************* *********************** ; ; ************************************************** ********************* device pic16c84,rc_osc,wdt_off,pwrt_on,protect_off id '8000' ; ************************************************** ********************** ; Timer program done by nik banda ; ************************************************** ********************* r0 equ 0ah r1 equ 0bh r2 equ 0ch r3 equ 0dh r4 equ 0eh r5 equ 0fh r6 equ 10h r7 equ 11h org 0000h ; ************************************************** ******************* jmp main ; jump over interrupt handler ; ************************************************** ******************* org 0032h main mov !porta, #0ch ; Initialise ports mov !portb, #00h ; port B output for seven segment clr r2 ; clear most of the registers clr r3 clr r4 clr r5 clr r6 mov r0, 01h ; put 0s in the registers for seven seg mov r1, 01h mov rtcc, #69h setb rp0 ; page one mov !option, #00h ; prescaler /2 clrb rp0 setb gie ; enable interrupts clrb rtif ; start timer setb rtie loop0 jb porta.2, loop0 clr r4 mov r5,#0ffh jb porta.3,$ clr r5 jmp loop0 ; ************************************************** ******************* change inc r2 cje r2, #10h, next loop2 mov w, r2 jmp seven mov r0, w clr r4 ret next clr r2 inc r3 cje r2, #10h, clear loop3 mov w, r3 jmp seven mov r1, w jmp loop2 clear clr r3 jmp loop3 seven jmp pc+w retw 01h retw 4fh retw 12h retw 06h retw 4ch retw 24h retw 20h retw 0dh retw 00h retw 04h ; ************************************************** ******************* org 0004h ;interrupt handler inc r4 cje r4, #0fah, next1 loop5 cje r6, #00h, next2 mov portb, #0ffh mov portb, r1 setb porta.1 clr r6 loop4 mov rtcc, #69h setb rp0 ; page one mov !option, #00h ; prescaler /2 clrb rp0 clrb rtif ; enable interrupts reti next1 cjne r7, #04h, loop5 cje r5, #0ffh, change jmp loop5 next2 mov portb, #0ffh mov portb, r0 setb porta.0 mov r6, #0ffh jmp loop4 ; ************************************************** ********************
__________________
wakagara sei iwewe ikoko? |
|
|
|
|
|
|
(permalink) |
|
If you wrote in PIC assembler it might help?.
What is that?, is it the long defunkt Parallax assembler?. |
|
|
|
|
|
|
(permalink) |
|
Wow, what is that?
Is it PIC51 mixup ? :lol: :lol: :lol:
__________________
"I share, thus I am" Jay.slovak Read this! ICD2 Clone Best PIC/DsPIC Bootloader Read my Inchworm ICD2 review! |
|
|
|
|
|
|
(permalink) | |
|
Quote:
As far as I recall it was discontinued well before the 16F84 ever saw the light of day?. Apparently it was intended to make PIC programming easier for 51 programmers, essentially it's just a series of macros. |
||
|
|
|
|
|
(permalink) |
|
That would explain why it uses pic16c84.
And I was right, it is PIC51 mixup (51 style code on a PIC).
__________________
"I share, thus I am" Jay.slovak Read this! ICD2 Clone Best PIC/DsPIC Bootloader Read my Inchworm ICD2 review! |
|
|
|
|
|
|
(permalink) |
|
Another suggestion:
I would love to take a shot at fixing your code. However, you should make it easy for us to help by posting it in "code" format.
__________________
"Having to do with Motion Control" |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|