simple adc flowchart programming pic16f616
Moderator: Benj
-
- Posts: 28
- Joined: Wed Sep 26, 2018 2:15 pm
- Has thanked: 3 times
- Been thanked: 3 times
- Contact:
simple adc flowchart programming pic16f616
Having a problem with what should be a simple bit of code, and a pic 16f616
Idea is to read voltages on analogue channels adc1 and adc2 and light led’s if their voltage is within adc0 voltage ±5%.
Flowchart works fine in flowcode but doesn’t when I program it to the 16F616. I think the oscillator settings are ok. with other pics I normally have to set the osccon to internal frequency required, but compiler rejects this for the 16f616.
When programming the pic, mloader seems to program OK but says it cannot verify due to possibly code protect option, but code protect is not enable in project options.
Attached is the flowchart, circuit diagram and pic data sheet
Thanks in advance for any suggestions
Idea is to read voltages on analogue channels adc1 and adc2 and light led’s if their voltage is within adc0 voltage ±5%.
Flowchart works fine in flowcode but doesn’t when I program it to the 16F616. I think the oscillator settings are ok. with other pics I normally have to set the osccon to internal frequency required, but compiler rejects this for the 16f616.
When programming the pic, mloader seems to program OK but says it cannot verify due to possibly code protect option, but code protect is not enable in project options.
Attached is the flowchart, circuit diagram and pic data sheet
Thanks in advance for any suggestions
- Attachments
-
- tr11016_iss1a.png
- (159.48 KiB) Downloaded 842 times
-
- 16f616.pdf
- (3.01 MiB) Downloaded 150 times
-
- TR11016_iss1a.fcfx
- (14.84 KiB) Downloaded 134 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: simple adc flowchart programming pic16f616
Hi Gavin,
An issue spotted with your flowchart.
You are using
What you are doing is logical variable testing but the AND is used for bitwise testing only.
Can you replace AND with &&
E.ginstead.
Then if still does not work for you, we can dive deeper into whats going on.
An issue spotted with your flowchart.
You are using
Code: Select all
adc2 >= adc0_l AND adc2 <= adc0_u
Can you replace AND with &&
E.g
Code: Select all
adc2 >= adc0_l && adc2 <= adc0_u
Then if still does not work for you, we can dive deeper into whats going on.
It is correct that OSCCON is rejected as that is not used in this device.gavin mack wrote:with other pics I normally have to set the osccon to internal frequency required, but compiler rejects this for the 16f616.
Martin
-
- Posts: 28
- Joined: Wed Sep 26, 2018 2:15 pm
- Has thanked: 3 times
- Been thanked: 3 times
- Contact:
Re: simple adc flowchart programming pic16f616
Hi
Made that change, no difference, flowcode simulation runs ok, but same result when pic programmed
Made that change, no difference, flowcode simulation runs ok, but same result when pic programmed
- Attachments
-
- TR11016_iss1a.fcfx
- (14.85 KiB) Downloaded 130 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: simple adc flowchart programming pic16f616
Ah, spotted two issues with configuration settings.
1) You have watchdog enabled.
Since you don't have Auto clear watchdog selected, you need to disable watchdog within configuration settings.
2) You have Master clear enabled as external, but you have not got a pull-up on pin 4.
You will need to change master clear enabled to internal.
1) You have watchdog enabled.
Since you don't have Auto clear watchdog selected, you need to disable watchdog within configuration settings.
2) You have Master clear enabled as external, but you have not got a pull-up on pin 4.
You will need to change master clear enabled to internal.
Martin
-
- Posts: 28
- Joined: Wed Sep 26, 2018 2:15 pm
- Has thanked: 3 times
- Been thanked: 3 times
- Contact:
Re: simple adc flowchart programming pic16f616
Hi
Tried that, no difference, even tried a new chip
I have also changed the code to a simple led flasher, which also doesn't work.
I think it must be the chip will not program correctly as i have connected an eblock led board to my eb006 port C, and the flashing led program doesn't work on this either.
The fact that it cannot verify the programming must be significant
Tried that, no difference, even tried a new chip
I have also changed the code to a simple led flasher, which also doesn't work.
I think it must be the chip will not program correctly as i have connected an eblock led board to my eb006 port C, and the flashing led program doesn't work on this either.
The fact that it cannot verify the programming must be significant
- Attachments
-
- test.fcfx
- (11.25 KiB) Downloaded 136 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: simple adc flowchart programming pic16f616
Yes, I have just remembered from the past, it is indeed.gavin mack wrote:he fact that it cannot verify the programming must be significant
It does mean that the chip has failed to program.
What version EB006 have you got?
I have got some 16F616 and will check this evening if it programs OK with EB006.
Is the Jumper for programming source connected to USB and not ICSP, as ICSP is for an external programmer only.
Make sure you only have one chip in the programmer and try unplugging from all the ports prior to programming.
Martin
-
- Posts: 28
- Joined: Wed Sep 26, 2018 2:15 pm
- Has thanked: 3 times
- Been thanked: 3 times
- Contact:
Re: simple adc flowchart programming pic16f616
it's an eb006 V9 which lists that chip in the documentation, I have only one chip in, jumpers are set ok
I have found a PIC16F1786 used on another job, and that works fine with eb006 board and led flash code.
so it's definitely programming the chip that's the problem
I have another 14 pin pic PIC16F1825-I/P, arriving today which I will try later
I have found a PIC16F1786 used on another job, and that works fine with eb006 board and led flash code.
so it's definitely programming the chip that's the problem
I have another 14 pin pic PIC16F1825-I/P, arriving today which I will try later
-
- Posts: 28
- Joined: Wed Sep 26, 2018 2:15 pm
- Has thanked: 3 times
- Been thanked: 3 times
- Contact:
Re: simple adc flowchart programming pic16f616
PIC16F1825-I/P works fine with led flasher. It also works fine with original flowcode adc
thanks for the help
thanks for the help
- Attachments
-
- test.fcfx
- (12.16 KiB) Downloaded 138 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: simple adc flowchart programming pic16f616
Tried 16F616 in my EB006 V9 and programmed chip with no issues.
Martin
-
- Posts: 28
- Joined: Wed Sep 26, 2018 2:15 pm
- Has thanked: 3 times
- Been thanked: 3 times
- Contact:
Re: simple adc flowchart programming pic16f616
Interesting, presumably you used the bottom left 20 pin socket.
mloader I'm using is 4.0.0.1
mloader I'm using is 4.0.0.1
-
- 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: simple adc flowchart programming pic16f616
Yes. Pin1 top left.gavin mack wrote:presumably you used the bottom left 20 pin socket.
Mloader that was shipped with FC8. Just compiled to chip.
If I manually run mLoader, version running is V4.0.0.1 as well.
Compiling to chip I have
Code: Select all
You have compiled in FREE mode.
Using Omniscient Code Generation that is available in PRO mode,
you could have produced up to 60% smaller and 400% faster code.
See http://www.microchip.com/MPLABXCcompilers for more information.
Compilation successful!
Launching the linker/assembler...
C:\Program Files (x86)\Flowcode v8\tools\DoNothing\DoNothing.exe
Launching the programmer...
C:\Program Files (x86)\Flowcode v8\tools\mLoader\mLoader.exe -chip 16F616 "D:\FC Testing\16F616 programming test1.hex"
Loading file...
File loaded from...
=> 16F616 programming test1.hex
File sending...
. . . . . .
File sent!
FINISHED
Martin
-
- Posts: 28
- Joined: Wed Sep 26, 2018 2:15 pm
- Has thanked: 3 times
- Been thanked: 3 times
- Contact:
Re: simple adc flowchart programming pic16f616
Hi
my mloader gives the same display. I have attached the compiler results file
eb006 v9 jumpers are set to 5V, PSU, USB, A6&7
my mloader gives the same display. I have attached the compiler results file
eb006 v9 jumpers are set to 5V, PSU, USB, A6&7
- Attachments
-
- compile_1.pdf
- (24.11 KiB) Downloaded 97 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: simple adc flowchart programming pic16f616
Hi Gavin,
The results posted does not include sending code to the chip, only compiling to hex.
Are you using compiler default values shown here: Just as a sanity check, can you place flowchart in a new folder on your root drive, and compile to chip?
The results posted does not include sending code to the chip, only compiling to hex.
Are you using compiler default values shown here: Just as a sanity check, can you place flowchart in a new folder on your root drive, and compile to chip?
Martin
-
- Posts: 28
- Joined: Wed Sep 26, 2018 2:15 pm
- Has thanked: 3 times
- Been thanked: 3 times
- Contact:
Re: simple adc flowchart programming pic16f616
Hi
I have same programmer settings
I tried compile to chip and it worked once, anytime after that it comes up with verify error. running Mloader and autodetecting chip works and I have erased chip which I assume will reset any code protection. If I then compile to chip again I get the verify error.
I also get same result when using a new folder on the root drive
I have same programmer settings
I tried compile to chip and it worked once, anytime after that it comes up with verify error. running Mloader and autodetecting chip works and I have erased chip which I assume will reset any code protection. If I then compile to chip again I get the verify error.
I also get same result when using a new folder on the root drive
-
- Posts: 28
- Joined: Wed Sep 26, 2018 2:15 pm
- Has thanked: 3 times
- Been thanked: 3 times
- Contact:
Re: simple adc flowchart programming pic16f616
HI
My compiler file is attached, it appears to be slightly different
My compiler file is attached, it appears to be slightly different
- Attachments
-
- compile_2.pdf
- (18.47 KiB) Downloaded 107 times