View previous topic :: View next topic |
Author |
Message |
Arizona Chris
Joined: 20 Dec 2014 Posts: 69 Location: Arizona
|
Program is STUCK in E3 board, now what? |
Posted: Wed Dec 31, 2014 11:27 am |
|
|
Hello all,
We purchased the E3 / book combo listed on the CCS web site to learn C. We are about half way through the book, and the learning is going well. Until now.
We are doing the chapter on interrupts. The book has you type in this code to show how it works:
Code: | #include <e3.h>
#include <ios.h> //must have for cout to work
int count;
#int_ext
void button_isr(void) {
count++;
}
void main() {
count = 0;
enable_interrupts(INT_EXT_H2L);
enable_interrupts(GLOBAL);
while(true) {
delay_ms(1000);
cout << "we got " << count << " interrupts" << endl;
}
}
|
Now here is the problem - the book is packed full of typos and here is another example, the button that initiates the interrupt is on int1 not int0 as the program shows and wont work. But once I loaded this program, now I cant replace it with any thing! When I compile even my tested lamp flashing program and load it it is still running the failed program. Just keeps on sending the message to the terminal "we got 0 interrupts" every second.
How do I fix this? why is the program stuck in the flash and cant be changed now?
Thanks. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Wed Dec 31, 2014 11:55 am |
|
|
I don't have any of that stuff but....
as to not being able to load a previous working program...
1) if using the bootloader are the USB connections OK? PC sees the device,etc??
2) I'd think you should be able to 'erase' the current program without deleting the bootloader.
3) the software is put into the wrong folders on the PC?
4) not the real admin ?
5) delete AND erase all the software, reinstall from scratch , following the directions from CCS
6) contact CCS at their official support website.....
hth
jay |
|
|
Arizona Chris
Joined: 20 Dec 2014 Posts: 69 Location: Arizona
|
stuck |
Posted: Wed Dec 31, 2014 12:19 pm |
|
|
Jay, my suspicion is that the bootloader is corrupt, so I cant update the program. I'm using the exact same setup I've used for weeks now to put programs into the E3 which have worked fine. Nothing has changed. I tried other USB ports, hitting "clean" and recompiling, but its never changing the program.
It may be a coincidence that the interrupt example program crashed it.
Is there a way to totally wipe the program with this bootloader intact I don't see like in MPLAB where I can "blank" a chip with my chip burner any function for this via CCS ide. Maybe I have to reinstall the bootloader? I wonder how you do that?
Anyones thoughts on this is appreciated.
Chris |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Dec 31, 2014 12:29 pm |
|
|
Quote: | with my chip burner |
If you have a PIC programmer, and you have the .hex file for the
bootloader, then you could connect the programmer to the ICSP
connector on the E3 board and re-program the 18F14K50 with the
bootloader code. Then you would be back in operation. |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
|
|
Arizona Chris
Joined: 20 Dec 2014 Posts: 69 Location: Arizona
|
Got it working - the book is still a frustration. |
Posted: Wed Dec 31, 2014 12:59 pm |
|
|
I have now changed this post 3 times as I find new issues. What I found was when you open a new source file, compile it, it was not reading it was compiling the file I had open! It kept on re compiling the source file that was stuck in the chip. I went under Options tab, and UNCHECKED the "Recall Open Files" checkbox. Problem gone.
Both me and my young son who are learning C for the first time together are both excited and pulling our hair out over this book! My 15+ years as a embedded micro controller programmer in other languages has given me patience. I have no hair left.
Chris |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Wed Dec 31, 2014 1:37 pm |
|
|
ah the 'fun' of learning something new......
I kept getting 'stung' by the MPLAB 'debug' mode until I email Microchip,talked to a senior support tech and he showed how to alter MPLAB to default to 'release' instead of 'debug'. Newer versions allow for this but 5 years ago........
sigh...
That PIC seems like a winner so I ordered 6 to 'play ' with.....
cheers
Jay |
|
|
|