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.

PIC16F628A Question

Status
Not open for further replies.
okok, but I want a 3 digit display with a decimal point.

XX.X

Therefore only up to 99.9

Its only for outside temperature so it will only reallly ever go to mid 40's in the peak of summer.

So i need the display to display Tens, Ones, and Decimal places, in that order.
 
To make it easy, mask to get the lowest 4 bits and firstly look to see if it is zero by moving the value in and out of a file and checking the zero bit in the Status register 03,2.
If it is zero, call the table and output the value to create a "0". If not, decrement the file and test for zero and at the same time increment the jump value for the table. When you have the value, send it to the display and call a short delay. Then blank the display.
Shift the 12bit number 4 places right and mask to get the lowest 4 bits to get the 2nd number.
shift 8 places to get the 3rd number. You have created the scan routine as well as the conversion routine with a few instructions.
You can be very smart and use one routine (3 times) to produce all the digits.



Your delay sub-routines are far too complex. They don't have to be accurate to 1 microsecond.
Remember this: A file is left with 0ffh after a decfsz and you can use this in a subsequent delay routine without having to load it with a value.


Look at this:

Code:
;250mS second delay
        
_250mS  nop
             goto            $+1        
             decfsz         DelA,1
             goto              _250mS
             decfsz         DelB,1
             goto              _250mS        
             retlw            00
 
Last edited:
Jake,

Have a read of this thread. In it myself and MikeK8LH discuss processing the fractional part in assembly - see page two.

Mike.
 
Thanks Pommie.
I had a read.

Wow.

I think I need some lessons in, well programming in general and full use of a uC's instruction set..

This self learning bussiness is taking too long haha
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top