PIC 16F887 not working
Moderator: Benj
PIC 16F887 not working
I can not get the PIC 16F887 to work.
I was about to give up on the PIC programming because of the C and assembly type of programming. I found flowcode so I downloaded demo to try and it out and it appears that everything is working but the PIC is not getting program. Please help I'm new to PICs. If I get this working I will buy the software. Thank you
Hardware PIC Kit 2 Debug Express. PIC 2 kit Demo board and a program example using this hardware.
Software Flowcode Demo 4.3.9.65
When I download to demo board I get no errors and a finished. The lights come on like they should on PICkit 2 but it doesn't look like the micro is loading the program.
Retested the Micro with MPLAB and it works fine.
Below is what I get when I compile to chip. I don't get a download successful see below.
File name: C:\Documents and Settings\HP_Administrator\My Documents\Flowchat\Test1.c
Generated by: Flowcode v4.3.9.65
Date: Sunday, January 22, 2012 21:45:10
Licence: Free version
***FREE/DEMO VERSION***
NOT FOR COMMERCIAL USE
http://www.matrixmultimedia.com
Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F887 "Test1.c"
.........................................
Return code = 0
Launching the linker/assembler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostlink.pic.exe -ld "C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\lib" libc.pic16.lib flowcode.pic16.lib rand.pic16.lib float.pic16.lib "Test1.obj" -t PIC16F887 -d "C:\Documents and Settings\HP_Administrator\My Documents\Flowchat" -p "Test1"
Return code = 0
Launching the programmer...
C:\Program Files\Matrix Multimedia\Flowcode V4\tools\PICkit2\pk2cmd.exe -PPIC16F887 -FTest1.hex -M -A5 -T -R -BC:\Program Files\Matrix Multimedia\Flowcode V4\tools\PICkit2\
.
Return code = 0
FINISHED
I was about to give up on the PIC programming because of the C and assembly type of programming. I found flowcode so I downloaded demo to try and it out and it appears that everything is working but the PIC is not getting program. Please help I'm new to PICs. If I get this working I will buy the software. Thank you
Hardware PIC Kit 2 Debug Express. PIC 2 kit Demo board and a program example using this hardware.
Software Flowcode Demo 4.3.9.65
When I download to demo board I get no errors and a finished. The lights come on like they should on PICkit 2 but it doesn't look like the micro is loading the program.
Retested the Micro with MPLAB and it works fine.
Below is what I get when I compile to chip. I don't get a download successful see below.
File name: C:\Documents and Settings\HP_Administrator\My Documents\Flowchat\Test1.c
Generated by: Flowcode v4.3.9.65
Date: Sunday, January 22, 2012 21:45:10
Licence: Free version
***FREE/DEMO VERSION***
NOT FOR COMMERCIAL USE
http://www.matrixmultimedia.com
Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F887 "Test1.c"
.........................................
Return code = 0
Launching the linker/assembler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostlink.pic.exe -ld "C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\lib" libc.pic16.lib flowcode.pic16.lib rand.pic16.lib float.pic16.lib "Test1.obj" -t PIC16F887 -d "C:\Documents and Settings\HP_Administrator\My Documents\Flowchat" -p "Test1"
Return code = 0
Launching the programmer...
C:\Program Files\Matrix Multimedia\Flowcode V4\tools\PICkit2\pk2cmd.exe -PPIC16F887 -FTest1.hex -M -A5 -T -R -BC:\Program Files\Matrix Multimedia\Flowcode V4\tools\PICkit2\
.
Return code = 0
FINISHED
- Attachments
-
- Test1.fcf
- (7 KiB) Downloaded 333 times
- fotios
- Posts: 458
- Joined: Mon Feb 08, 2010 10:17 am
- Location: Greece
- Has thanked: 109 times
- Been thanked: 117 times
Re: PIC 16F887 not working
Hello txbyg
Your Flow Chart is correct, so compiler - linker - assembler don't show any error (all Return codes = 0). Your project is not working on actual hardware, because you haven't "set-up" your P16F887. Using FlowCode, is very simple to do this:
1) Click "View" on the menu bar, and then on "Project Options" from the drop down menu. In the table that opens you should select a "clock speed". In the modified *fcf i selected "4000000" Hz, which is a usual 4MHz clock when we use the precision internal oscillator of P16F887. Please note that the max speed offered from it, is 8MHz. I did it because i don't know which is your demo board and so the frequency of on-board XTAL.
2) Click "Chip" on the menu bar, and then on "Configure" from the drop down menu. On the table that opens, click on "Switch To Expert Config Screen". You can see the configuration of P16F887 that i did.
I tried the project on actual hardware thru the use of e-blocks: EB006 programming board + Switch board + LED board.
The project is working just fine, exactly as is shown in your Flow Chart and in FlowCode simulator. If it is necessary - i think you can test the program without modifications on your demo board though - switch your demo board from "external oscillator" to "internal" to be able to test the modified program. Later, you can try it with the external oscillator by making the same 2 steps described above.
Attached is the modified fcf
Fotis
Your Flow Chart is correct, so compiler - linker - assembler don't show any error (all Return codes = 0). Your project is not working on actual hardware, because you haven't "set-up" your P16F887. Using FlowCode, is very simple to do this:
1) Click "View" on the menu bar, and then on "Project Options" from the drop down menu. In the table that opens you should select a "clock speed". In the modified *fcf i selected "4000000" Hz, which is a usual 4MHz clock when we use the precision internal oscillator of P16F887. Please note that the max speed offered from it, is 8MHz. I did it because i don't know which is your demo board and so the frequency of on-board XTAL.
2) Click "Chip" on the menu bar, and then on "Configure" from the drop down menu. On the table that opens, click on "Switch To Expert Config Screen". You can see the configuration of P16F887 that i did.
I tried the project on actual hardware thru the use of e-blocks: EB006 programming board + Switch board + LED board.
The project is working just fine, exactly as is shown in your Flow Chart and in FlowCode simulator. If it is necessary - i think you can test the program without modifications on your demo board though - switch your demo board from "external oscillator" to "internal" to be able to test the modified program. Later, you can try it with the external oscillator by making the same 2 steps described above.
Attached is the modified fcf
Fotis
- Attachments
-
- Test1_mod.fcf
- (7 KiB) Downloaded 341 times
Best Regards FOTIS ANAGNOSTOU
Re: PIC 16F887 not working
Benj
I tried the changes and got the same result. I also tried your project and same result. I have included the sample that I followed and the info on my demo board. Below are the pdf.
I went back and tested my project board with MPLAB and down loaded a project and it worked. Not sure what is going on.
I tried the changes and got the same result. I also tried your project and same result. I have included the sample that I followed and the info on my demo board. Below are the pdf.
I went back and tested my project board with MPLAB and down loaded a project and it worked. Not sure what is going on.
- fotios
- Posts: 458
- Joined: Mon Feb 08, 2010 10:17 am
- Location: Greece
- Has thanked: 109 times
- Been thanked: 117 times
Re: PIC 16F887 not working
Hello txbygtxbyg wrote:Benj
I tried the changes and got the same result. I also tried your project and same result. I have included the sample that I followed and the info on my demo board. Below are the pdf.
I went back and tested my project board with MPLAB and down loaded a project and it worked. Not sure what is going on.
I am Fotios, not Ben
I can't see your pdf, you forgot to "Upload the Attachment". Please, try with MPLAB IDE to program the P16F887. Attached is the project in *hex format so that you can open it with MPLAB:
1) Download and save in your PC the hex file e.g. in "My Documents" folder.
2) Open MPLAB IDE and from the "File" menu click on "Import". From the window that opens, find the location where the "Test1_mod.hex" is stored and then double click on it. The file has been now imported.
3) From the "View" menu, click on "Program Memory". Then you can check the program code. Try to program P16F887 with your PICkit2 programmer. Check the result using the PIC demo board. If the program runs correctly, then the problem is located in the link between FlowCode and the PICkit programmer but this is not shown in the resulted compiler message of your first post. From those that i know, if you can build and simulate a project with the FlowCode demo version, you can also program the microcontroller with it. If the program still does not runs correctly, then something is going wrong on your demo board. I will take a look on PICkit2 demo boards datasheet, i think there are just two.
Please let me know the result.
Fotis
- Attachments
-
- Test1_mod.hex
- (768 Bytes) Downloaded 312 times
Last edited by fotios on Tue Jan 24, 2012 11:45 am, edited 1 time in total.
Best Regards FOTIS ANAGNOSTOU
- fotios
- Posts: 458
- Joined: Mon Feb 08, 2010 10:17 am
- Location: Greece
- Has thanked: 109 times
- Been thanked: 117 times
Re: PIC 16F887 not working
Hello txbyg
Just now i looked in PICkit2 demo boards offered from Microchip. Since the target mcu is the P16F887, by sure your demo board is the 44pin one.
In your FlowCode, the switch B0 is modified as "Active High" while in demo board the switch connected at port RB.0 is modified as "Active Low". Additionaly, is connected at RB.0 to cause Interrupt.
Although the initial program should runs by some way, be it so in wrong mode, i made two new FC files. In the first i simply changed the switch with a new in "Active Low" configuration, while in the second i also enabled the RB.0 Interrupt. I hope the FlowCode demo version will be able to compile the second file.
If your demo board is indeed equiped with a 10MHz XTAL as is shown in schematics, i modified one of the two FCF files to work in XT mode. Please try it.
But as i mentioned in my previous post, please don't forget to try the *hex file with MPLAB IDE.
Fotis
Just now i looked in PICkit2 demo boards offered from Microchip. Since the target mcu is the P16F887, by sure your demo board is the 44pin one.
In your FlowCode, the switch B0 is modified as "Active High" while in demo board the switch connected at port RB.0 is modified as "Active Low". Additionaly, is connected at RB.0 to cause Interrupt.
Although the initial program should runs by some way, be it so in wrong mode, i made two new FC files. In the first i simply changed the switch with a new in "Active Low" configuration, while in the second i also enabled the RB.0 Interrupt. I hope the FlowCode demo version will be able to compile the second file.
If your demo board is indeed equiped with a 10MHz XTAL as is shown in schematics, i modified one of the two FCF files to work in XT mode. Please try it.
But as i mentioned in my previous post, please don't forget to try the *hex file with MPLAB IDE.
Fotis
- Attachments
-
- Test1_INT.fcf
- (7 KiB) Downloaded 327 times
-
- Test1_correct.fcf
- (7 KiB) Downloaded 284 times
-
- Test1_correctXT.fcf
- (7 KiB) Downloaded 286 times
Last edited by fotios on Tue Jan 24, 2012 11:42 am, edited 2 times in total.
Best Regards FOTIS ANAGNOSTOU
- fotios
- Posts: 458
- Joined: Mon Feb 08, 2010 10:17 am
- Location: Greece
- Has thanked: 109 times
- Been thanked: 117 times
Re: PIC 16F887 not working
Here the other in which is used Interrupt, in XT mode.
Hope the problem will resolved.
EDIT: To be sure that all these files which are generated thru the use of Flow Code are correct, i compiled them in *hex format so as i can Import them in MPLAB IDE (i did the same i suggested you, the only difference is that i used the ICD2 programmer). Then i programed 6 times a P16F887 using MPLAB IDE + MPLAB ICD2 on a custom made programming - demo board, and i can confirm you that in all cases the device programmed correctly and it runs on actual hardware as it should runs according to FlowCharts.
Fotis
Hope the problem will resolved.
EDIT: To be sure that all these files which are generated thru the use of Flow Code are correct, i compiled them in *hex format so as i can Import them in MPLAB IDE (i did the same i suggested you, the only difference is that i used the ICD2 programmer). Then i programed 6 times a P16F887 using MPLAB IDE + MPLAB ICD2 on a custom made programming - demo board, and i can confirm you that in all cases the device programmed correctly and it runs on actual hardware as it should runs according to FlowCharts.
Fotis
- Attachments
-
- Test1_INTxt.fcf
- (7 KiB) Downloaded 319 times
Best Regards FOTIS ANAGNOSTOU
-
pierreazar
- Posts: 2
- Joined: Sat May 19, 2012 11:20 am
Re: PIC 16F628A not working
Hello im making a project to make the pic 16F628A interface a gsm modem via rs232 first i should send two At commands to the gsm modem: "AT+CPIN=0000" AND "AT+CNMI=1,2,0,0,0" then i want to toggle on and off the outputs of the pic through an sms . i made the program it is working by simulation in flowcode and i tried with real pic simulator it also works. but on real hardware nothing is working i made all the configurations but nothing works. i copied the hex file and tried with brenner programmer and with easy pic 6 the program is downloaded but nothing works. and im sure about the programmers i wrote a sample in mplab to send and receive characters it worked. and ive tried 4 chips . im using an oscillator 20MHZ . i attached my program thank you
- Attachments
-
- Flowcode1.fcf
- (14.32 KiB) Downloaded 310 times
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: PIC 16F887 not working
Hi pierreazar,
I know you have got Auto clear watchdog enabled,
but try disabling watchdog timer and low voltage programming in configuration settings.
Also try without Auto clear watchdog enabled.
If it works we can take it from there to enable watchdog timer.
Martin
I know you have got Auto clear watchdog enabled,
but try disabling watchdog timer and low voltage programming in configuration settings.
Also try without Auto clear watchdog enabled.
If it works we can take it from there to enable watchdog timer.
Martin
Martin
-
pierreazar
- Posts: 2
- Joined: Sat May 19, 2012 11:20 am
Re: PIC 16F887 not working
Hi Martin ,
i disabled watchdog timer and low voltage programming now it sends the two at commands . but it doesn't receive the string to compare it and toggle on an output.
when i turn on watchdog timer nothing is working . and when i enable autoclear watchdog timer its always sending the at commands in a loop forever . Please help me. thank you
i disabled watchdog timer and low voltage programming now it sends the two at commands . but it doesn't receive the string to compare it and toggle on an output.
when i turn on watchdog timer nothing is working . and when i enable autoclear watchdog timer its always sending the at commands in a loop forever . Please help me. thank you
- DavidA
- Matrix Staff
- Posts: 1076
- Joined: Fri Apr 23, 2010 2:18 pm
- Location: Matrix Multimedia Ltd
- Has thanked: 58 times
- Been thanked: 258 times
- Contact:
Re: PIC 16F887 not working
Hello,
I see you are posting a Flowcode v4 program, as such I will move this to the relevant part of the forum, please follow this link on instructions on how to register for the v4 forums.
http://www.matrixmultimedia.com/mmforum ... =29&t=8762
I see you are posting a Flowcode v4 program, as such I will move this to the relevant part of the forum, please follow this link on instructions on how to register for the v4 forums.
http://www.matrixmultimedia.com/mmforum ... =29&t=8762