PICBasic Serial Interrupts With PIC16F877

30,907

12

4

www.leevonk.com

Intro: 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.

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.

Share

    Recommendations

    • Optics Contest

      Optics Contest
    • Audio Contest 2018

      Audio Contest 2018
    • Electronics Tips & Tricks Challenge

      Electronics Tips & Tricks Challenge

    4 Discussions

    0
    None
    josheeg

    10 years ago on Introduction

    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.

    0
    None
    jellyfish

    12 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.

    1 reply
    0
    None
    leevonkjellyfish

    Reply 12 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.