Design News is part of the Informa Markets Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Great Cow BASIC Is Your Alternative to Programming PIC Chips in “C

Great Cow BASIC Is Your Alternative to Programming PIC Chips in “C

Microchip PIC chip applications have traditionally been programmed using the MPLAB or MPLABX Integrated Development Environment (IDE) development tools. These coding tools allow hardware engineers to build embedded devices concepts quite effectively. Electrical engineers, especially, have grown accustomed to building their embedded software using variations of the ANSI C programming language known as Embedded C.

The Embedded C language variations is based on the microcontroller manufacturer's architecture and specifications of the device's GPIO (General Purpose Input/Output) ports, timers, counters, and SFRs (Special Functions Registers).

But I recently discovered an alternative coding language that is easy to learn and can program PIC chips as effectively as Embedded C.

What is Great Cow Basic?

For those Design News readers who are familiar with Beginner's All-purpose Symbolic Instruction Code (BASIC), PIC chips can now be programmed using this coding language. Great Cow Basic (GCB) allows Microchip PIC chips to be programmed easily using this alternative programming language. The learning curve for GCB is quite small, therefore allowing you to build your embedded device software within several minutes. To illustrate the ease in which to build an embedded device, I'll present my PIC chip-SNAP Circuit LED Flasher as the example:

The PIC chip-SNAP Circuit LED Flasher

Flashing LEDs is the physical equivalent of the "Hello World" program used in most college, university, and semiconductor manufacturer introductions to programming microcontrollers. Therefore, keeping tradition alive, I'm following the same path. The PIC chip SNAP Circuit LED Flasher requires a few basic components: an LED; a series current limiting resistor; a 3V power supply; an ON/OFF slide or toggle switch; and a microcontroller. The circuit schematic diagram for the PIC chip SNAP Circuit LED Flasher is shown next.

I selected the PIC chip 10F206 microcontroller because the SNAP Circuit kit provides an 8-pin IC socket for adding a LM386 op-amp or 555 Timer components to build your own electronic gadgets and devices. With the PIC chip 10F206 microcontroller, I can build a variety of smart devices by adding GCB embedded software to the programmable IC. The pin out for the PIC chip 10F206 microcontroller is provided below:

Building the LED Flasher

To build and test the simple LED Flasher, I used the Microchip PICDEM lab development board. This board provides a wealth of onboard resources such as a PICKIT Serial Analyzer, piezo speaker, a potentiometer, a dc brushed motor, and solderless breadboard. In addition to the PIC10F206 device the PICDEM includes the PIC 16F88, and 16F690 microcontrollers.

There are several dual and single inline female header connectors for wiring external circuits to the supporting microcontroller pins. Each microcontroller has an ICSP programming header for attaching a PICKIT programmer. The GCB IDE requires a PICKIT2 or PICKIT3 to program the target microcontrollers. Using the circuit schematic diagram previously shown, I built the LED flasher circuit on the PICDEM lab development board.

Building the GCB LED Flasher code

With the LED wired to GP0 (pin 5) of the PIC10F206 microcontroller. I was able to write the code using the GCB IDE. The IDE is quite typical of most programming development tools consisting of a project tree, text editor, and output window. The GCB IDE is shown next.

Like most new development tools, a process for creating source code, generating a hex file, and flashing the microcontroller had to be discovered within the IDE. Once I became familiar with the code development icons within the GCB IDE, I developed a reference process flow diagram to use in building future Great Cow Basic projects.

The source code (.gcb) for the LED flasher is show below:

Click here to view Figure 7.

After entering the source code into the GCB IDE, I was able to create a ".hex" and flash it to the PIC10F206 microcontroller. I used the PICKIT2 as the programming tool to connect the microcontroller to the IDE generated ".hex" file. With the microcontroller programmed, the LED began to flash on the PICDEM lab development board.

Click here to view Figure 8.

The PIC chip SNAP Circuit LED Flasher

With the LED flasher code working properly, the final step of the project was to use the programmed microcontroller in an electronic gadget. As discussed earlier, the SNAP Circuit kit made by Elenco was the obvious choice in building the final electronic gadget.

Using the circuit schematic diagram, I built the PIC chip SNAP Circuit within a few minutes. The nice feature about the SNAP Circuit kit is the LED module has an internal resistor. Therefore the part's count for the project was reduced from five instead of the original six components shown in the circuit schematic diagram. After building the LED circuit using the kit, I carefully removed the PIC10F206 from the lab development board and inserted into the SNAP Circuit kit 8-pin IC socket. I placed two 1.5V AA batteries into the battery holder and slid the single pole switch in the ON position. The LED began to flash on the SNAP Circuit kit.

Click here to view Figure 9.

To improve the look of the PIC chip -SNAP Circuit flasher, I replaced the LED with a seven segment LED display. I wired the optoelectronic part to display the letter "H".

Click here to view Figure 10.

I hope you can see the ease in which a PIC chip can be programmed using Great Cow Basic language. A programmer language guide, installation instructions, and IDE reference material along with example code can be found on the GCB website.

Show: ESC Track: Embedded Software Design & Verification


ESC Minn logoEmbedded Software at Work. Get the details on battery management, compiler optimization, re-usable HAL, ins and outs of Open Source, safety critical system software, cybersecurity concerns and more in the Embedded Sardware Design & Verification track at the Embedded Systems Conference. Sept. 21-22, 2016 in Minneapolis. Register here for the event, hosted by Design News’ parent company UBM.


Don Wilcher is a passionate teacher of electronics technology and an electrical engineer with 26 years of industrial experience. He’s worked on industrial robotics systems, automotive electronic modules/systems, and embedded wireless controls for small consumer appliances. He’s also a book author, writing DIY project books on electronics and robotics technologies. His latest book, Make: Basic Arduino Projects, published by Maker Media, is on the Alabama State Department’s approved Career and Technical Education (CTE) reading list. He’s currently developing 21st century educational training products and curriculum focusing on Internet of Things (IoT) and Industrial Physical Computing for makers, engineers, technicians, and educators. Besides being an Electrical Engineer, he’s a Certified Electronics Technician with ETA International and Alabama State Certified Electronics Instructor.

[Images source: Don Wilcher]

Hide comments
account-default-image

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish