Hi all
I use a PIC10F204 for a simple project.
I need actived a led when the voltage at the pin GP0 is major at the 06V, internal refernce voltage at the comparator.
I read that the flowcode not simulate the internal comparator, is correct?
when I tried at connect a potentiometer at pin GP0 for simulate,is not was possible, why?
i tried set a comparator with C code, is it possible?, and the internal register, for example "CMCON0" is simulated in flowcode?.
for this simple project I can programmer in assembly code, but I would like tried wìth flowcode. thankyou for your advises and sorry for my bad english.
I attack an example
Comparator PC10f204
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Comparator PC10f204
Hello,

Currently Flowcode doesn't support internal comparator modules. If you want to use them you have to use your own C code inside C icons to drive the peripheral registers. We have tried a number of times to include comparators but they differ so much from device to device that it quickly gets very complicated.I read that the flowcode not simulate the internal comparator, is correct?
The ADC components require an ADC peripheral and an ADC capable input pin. The 10F204 has neither of these features just a comparator.when I tried at connect a potentiometer at pin GP0 for simulate,is not was possible, why?
The C code icons won't simulate, they will be ignored by the simulator. However they will compile and work on the target device.i tried set a comparator with C code, is it possible?, and the internal register, for example "CMCON0" is simulated in flowcode?.
You are very welcome and your English is very good, both clear and understandablethankyou for your advises and sorry for my bad english.

Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Comparator PC10f204
Thanks Benj
All is clear, I'll try tomorrow.
Flowcode is very good, I'm not a programmer, I'm hardware specialist, and flowcode for me is perfect for realized a my Christmas project.
only question, exist one list of command "C" code correct or different for flowcode?,
for example,
tes_bit , set_bit ecc.
thankyou very much
All is clear, I'll try tomorrow.
Flowcode is very good, I'm not a programmer, I'm hardware specialist, and flowcode for me is perfect for realized a my Christmas project.
only question, exist one list of command "C" code correct or different for flowcode?,
for example,
tes_bit , set_bit ecc.
thankyou very much
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Comparator PC10f204
Hello,
For general purpose bit manipulation using a C code icon you can call these functions.
for example
Will set bit 0 in the MyVar Flowcode global variable.
For more specific register manipulation on a PIC device where you want to specifically reference a bit in a register by name you can also use these functions.
for example
You can refer to the device datasheet for the register names and bit names.
For general purpose bit manipulation using a C code icon you can call these functions.
Code: Select all
set_bit(var,bitno) //Sets a single bit
clear_bit(var,bitno) //Clears a single bit
test_bit(var,bitno) //Tests a single bit
Code: Select all
set_bit(FCV_MYVAR, 0);
For more specific register manipulation on a PIC device where you want to specifically reference a bit in a register by name you can also use these functions.
Code: Select all
st_bit(var,bitno) //Sets a register bit
cr_bit(var,bitno) //Clears a register bit
ld_bit(var,bitno,val) //Loads a register bit as a 0 or 1
ts_bit(var,bitno) //Tests a register bit and returns true or false
for example
Code: Select all
cr_bit(TRISA,TRISA0); //Convert Port Pin A0 into an output
st_bit(PORTA,RA0); //Set output pin A0 high
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- STibor
- Posts: 263
- Joined: Fri Dec 16, 2011 3:20 pm
- Has thanked: 116 times
- Been thanked: 113 times
- Contact:
Re: Comparator PC10f204
Hello!
I attach an example.
Not tested in hardware.
I attach an example.
Not tested in hardware.
- Attachments
-
- COMPARATOR_10F204.fcfx
- (9.58 KiB) Downloaded 272 times
Re: Comparator PC10f204
Hi
I tested firmware send from STibor, perfect funcionally, I changed only configuration pin "CIN-" because I used internal reference value.
For me is very important understend "C code" icon, your example is very exaustive.
Thankyou very much
I tested firmware send from STibor, perfect funcionally, I changed only configuration pin "CIN-" because I used internal reference value.
For me is very important understend "C code" icon, your example is very exaustive.
Thankyou very much