Instructables

PICBasic serial interrupts with PIC16F877

simple example code to use serial interrupts for the PIC16F877.
1) a matlab program sends the PIC numbers
2) the PIC will pause whatever it's doing,
3) get the numbers and display them on LEDs,
4) and then continue on with what it was doing.
 
Remove these adsRemove these ads by Signing Up

Step 1: Here's the code, enjoy

see the code in the txt file. It is very simple and very well commented and it's a bare minimum of what you need for PIC serial interrupts. The txt file has the matlab and the PICBasic code. Took me a day to figure all this out and boil it down to the essentials (what you'll find in my txt file). The PICBasic code is based off of example code from the internet.
hani_aast5 years ago
I want the complete circuit plz
josheeg6 years ago
I liked useing Great Cow basic a free open source basic for the 16F877A PIC chip it works great in windows and will compile for linux.
jellyfish7 years ago
this is a great little example. i can see the potential! are you self taught? i've been working with the PIC under the pressure of having to teach it. i feel i've got a pretty good grip on the basics (no heavy lifting with serial communications) and i feel i've barely scratched the surface. it's nice to look at your code and understand what's going on. so much of the time i find some assembly language wierdness ellusivity.
leevonk (author)  jellyfish7 years ago
Thanks. Serial comunication can be annoying (custom cable connections, RS232 to TTL voltage levels, baud rates, etc). Use a feedback loop (connect serial port's 'out' pin with the 'in' pin) and hyperterminal (free prog that comes with windows) to test your computer's serial output before you try to connect to external electronics (like the PIC). Yeah, I guess I'm self taught, I started with BasicStamps and worked up to PICs when the basic stamp wasn't good enough for my projects. The PIC code is just in PICBasic, not assembly language. It would be really long and messy if it was in assembly. They do have assembly language interupt code examples in the PICBasic manual though.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!