Hi all,
I have found a really strange issue.
I have this LCD clock written in ASM, and that runs fine on a PIC16F627.
If I program a 16F628A with the same code, I'll get a very weird thing, and that is that the Hour display en minute display is written as follows:
00h = 80
12h = 92
23h = 03
00h = 80
.. etc
this is the same for the minutes.
Now I use a conversion routine (see below) to convert a number from W to ones, tens etc etc to convert this into text to send to the display.
Could it be that this routine is behaving deffirent on a 628A???
All other stuff works fine (inputs, other characters on the display etc), its only the output/conversion of the hours/minutes..
anyone an idea??
[edit]
in MLAB IDE, i do not see any strange things if I debug the conversion!
[/edit]
I have found a really strange issue.
I have this LCD clock written in ASM, and that runs fine on a PIC16F627.
If I program a 16F628A with the same code, I'll get a very weird thing, and that is that the Hour display en minute display is written as follows:
00h = 80
12h = 92
23h = 03
00h = 80
.. etc
this is the same for the minutes.
Now I use a conversion routine (see below) to convert a number from W to ones, tens etc etc to convert this into text to send to the display.
Could it be that this routine is behaving deffirent on a 628A???
All other stuff works fine (inputs, other characters on the display etc), its only the output/conversion of the hours/minutes..
anyone an idea??
[edit]
in MLAB IDE, i do not see any strange things if I debug the conversion!
[/edit]
Code:
;This routine downloaded from http://www.piclist.com
Convert: ; Takes number in NumH:NumL
; Returns decimal in
; TenK:Thou:Hund:Tens:Ones
swapf NumH, w
iorlw B'11110000'
movwf Thou
addwf Thou,f
addlw 0XE2
movwf Hund
addlw 0X32
movwf Ones
movf NumH,w
andlw 0X0F
addwf Hund,f
addwf Hund,f
addwf Ones,f
addlw 0XE9
movwf Tens
addwf Tens,f
addwf Tens,f
swapf NumL,w
andlw 0X0F
addwf Tens,f
addwf Ones,f
rlf Tens,f
rlf Ones,f
comf Ones,f
rlf Ones,f
movf NumL,w
andlw 0X0F
addwf Ones,f
rlf Thou,f
movlw 0X07
movwf TenK
; At this point, the original number is
; equal to
; TenK*10000+Thou*1000+Hund*100+Tens*10+Ones
; if those entities are regarded as two's
; complement binary. To be precise, all of
; them are negative except TenK. Now the number
; needs to be normalized, but this can all be
; done with simple byte arithmetic.
movlw 0X0A ; Ten
Lb1:
addwf Ones,f
decf Tens,f
btfss 3,0
goto Lb1
Lb2:
addwf Tens,f
decf Hund,f
btfss 3,0
goto Lb2
Lb3:
addwf Hund,f
decf Thou,f
btfss 3,0
goto Lb3
Lb4:
addwf Thou,f
decf TenK,f
btfss 3,0
goto Lb4
retlw 0x00
end