765/5000
Hello. I set up the code for a triac thermostat controlled by a 12F675 PIC, but some error is occurring. The thermostat works as follows: a zero crossing detector sends a high level signal to the microcontroller and after that, the microcontroller varies the triac drive actuation delay time until the desired temperature is reached. The longer the delay time on the drive (lag in the triac firing angle) the lower the output power of the triac. I used the code on a 16F88 pic and it worked very well. I can't read the ADC for 10 bits. I did not find the error. The problem is reading the ADC. Could someone check the code for me and try to find the fault?
Problem reading 10-bit ADC on 12F675 PIC
-
- Posts: 37
- Joined: Tue Jul 17, 2018 11:30 am
- Has thanked: 7 times
- Been thanked: 3 times
- Contact:
Problem reading 10-bit ADC on 12F675 PIC
- Attachments
-
- Triac_Interrupt_12F675.JPG (171.74 KiB) Viewed 3580 times
-
- Triac_Interrup_12F675.fcfx
- (17.22 KiB) Downloaded 230 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Problem reading 10-bit ADC on 12F675 PIC
Hi Oderlando.
You have got:
Yet, Count_Interrupt has been assigned as a Bool which can only be 0 or 1:
Therefore ADC will never be read.
Also the interrupt assign must only be activated once, so it needs to be placed before the main loop.
You have got:
Code: Select all
Count_Interrupt = 1953
Also the interrupt assign must only be activated once, so it needs to be placed before the main loop.
Martin
-
- Posts: 37
- Joined: Tue Jul 17, 2018 11:30 am
- Has thanked: 7 times
- Been thanked: 3 times
- Contact:
Re: Problem reading 10-bit ADC on 12F675 PIC
I modified the flowchart and applied some minor improvements. For 8-bit ADC reading, everything goes perfectly fine. I am sending the flowchart that works. But, something still leaves me in doubt ... When I try to read the 10-bit ADC, an error message is displayed during compilation. I tried in every way possible and all my options were exhausted. I am sending a print of the error screen. If possible, I would like you to help me read ADC through "GetInt".
- Attachments
-
- Fail.JPG (75.38 KiB) Viewed 3538 times
-
- Triac_Interrup_12F675_2.fcfx
- (17.15 KiB) Downloaded 228 times
- 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: Problem reading 10-bit ADC on 12F675 PIC
Hello,
You have ran out of RAM on the device.
To increase the available RAM you can remove the string manipulation variables from the project.
Open the following file in a text editor, maybe make a backup so you can easily go back when you need to.
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\internals.c
Near the top of the file find these lines.
comment out the two variables and this should give you more RAM space to use for your own variables and allow the program to compile correctly again.
You have ran out of RAM on the device.
To increase the available RAM you can remove the string manipulation variables from the project.
Open the following file in a text editor, maybe make a backup so you can easily go back when you need to.
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\internals.c
Near the top of the file find these lines.
Code: Select all
#if !defined(MX_10F_TRIS) && !defined(MX_16F5x_TRIS)
unsigned char FCI_TMP_STR[20];
int FCI_TMP_INT;
#else
#warning "String temporary variables not defined to save on limited RAM space on your current target device"
#endif
Code: Select all
#if !defined(MX_10F_TRIS) && !defined(MX_16F5x_TRIS)
//unsigned char FCI_TMP_STR[20];
//int FCI_TMP_INT;
#else
#warning "String temporary variables not defined to save on limited RAM space on your current target device"
#endif
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