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.

internal comparator - table (pic12f675)

Status
Not open for further replies.
alamy said:
pls look to the attachment..

thanks..

I'm not very clear what you are actually wanting to do, but I'm presuming you have routines reading the two analogue inputs which both produce a value from 0-7?

To produce an index into a 64 word lookup table all you need to do is multiply the reading from SP2 by 8 (giving 0, 8, 16, 24 etc) and then add the value of SP1. You can easily multiply by 8 by shifting left four times.
 
My systems have 2 analog inputs and 3 outputs (may expand to 8 but the pic12f675 reserve me just 3 outputs).

Actually my idea is to implement this task…

The statement is…
If input1 is b’00001011’ and input2 is b’00001001’ then output is b’010’

Where as ’00001011’ is set point (SP1) for input1 and b’00001001’ is set point (SP1) for input2. Also I do have another 7 set points both for input 1 & 2. Meaning that I’ll have 64 different if-then statements. Also for outputs.

Maybe for the statement above, I can write like this,

Code:
;Routine to check input 1
ChcIn1	Btfss In1,SP1
                Goto Data1
                Btfss In1,SP2
                Goto Data2
                        :
                        :
                btfss In1,SP8
                Goto Data8
                Goto main

Where as In1 is analog input1 and Data1-8 is subroutine to process my input so that I can combine with Data (9-16; for In2) but I do not know how to process it.

Pls advice.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top