Arduino with pic

Arduino with pic DEFAULT

Introduction: Pinguino Project (a PIC Microcontroller Based Arduino #No Programmer Required)

Hey Guys i am Back after 2 months with Awesome Project,This is a Complete tutorial to make PIC Microcontroller based Arduino ,which can run Arduino Programs on PIC18F4550 or PIC18F2550 Microcontroller , one advantage on this microcontroller is ,it does'nt require any External Programmers, Since it has inbuilt USB support .so guys lets get started

Step 1: Things Needed !

1) PIC18F2550 (28pin) -1

2) Crystal 20Mhz -1

3) Capacitor -22pf -2

4) Resistor 470ohm - 2

5) USB B type PCB mount - 1

6) Capacitor 220nf - 1

7) Jumpers -few

8) LED - 1 or 2

9) Push button

10) Resistor 10K ohm - 1

Step 2: Circuit Diagram for Pinguino Board

Connect all the components as shown in the circuit diagram on Breadboard or you can make your own PCB board , here i used Breadboard for my project.

Step 3: Downloading PINGUINO IDE

Download Pinguino IDE from this website

http://www.pinguino.cc/download.php

Step 4: Download Bootloader File !

https://github.com/PinguinoIDE/pinguino-bootloader...

Step 5: I Used PICKIT2 Which I Purchased It From Amazon India

https://electrosome.com/pickit2/

Here we just need to put microcontroller on to the ZIF socket and connect it to pC, open PICKIT2 Software and Upload the Code

NOTE: if you are using standard PICKIT2 then follow next step !

Step 6: How to Use PICKIT2 to Upload HEX File to the PIC Microcontroller

Download PICKIT2 software here:

http://pickit2.software.informer.com/download/

Download PDF from Microchip on uploading HEX file to PIC microcontroller using PICKIT2

http://ww1.microchip.com/downloads/en/DeviceDoc/PI...

PICkit is a family of programmers for PIC microcontrollers made by Microchip Technology. They are used to program and debug microcontrollers, as well as program EEPROM. Some models also feature logic analyzer and serial communications (UART) tool.
The PICkit 2 — introduced in May 2005 — replaced the PICkit 1. The most notable difference between the two is that the PICkit 2 has a separate programmer/debugger unit which plugs into the board carrying the chip to be programmed, whereas the PICkit 1 was a single unit. This makes it possible to use the programmer with a custom circuit board via an In Circuit Serial Programming (ICSP) header. This feature is not intended for so-called "production" programming, however. The PICkit 2 uses an internal PIC18F2550 with Full Speed USB. The latest PICkit 2 firmware allows the user to program and debug most of the 8 and 16 bit PIC micro and dsPIC members of the Microchip product line.

More info from this website : https://www.pantechsolutions.net/microcontroller-b...

Step 7: After Bootloading

Make pinguino Circuit and connect it to the computer through USB, Uploadd pinguino project drivers,

you can download it from Pinguino official website and everything is ready to Code.

http://www.hackinglab.org/pinguino/download/driver...

http://wiki.pinguino.cc/index.php/Windows_XP_Drive...

Step 8: PInguino BLINK

void setup()

{

pinMode(USERLED, OUTPUT);

}

void loop()

{

digitalWrite(USERLED, LOW);

delay(50);

digitalWrite(USERLED, HIGH);

delay(50);

}

For more examples : http://wiki.pinguino.cc/index.php/6_ways_to_blink_...

Step 9: Uploading Code to Pinguino Board

Step 10: Build Your Own Pinguino on PCB...

Build you own PCB and solder all components.i have uploaded design files download and follow PCB designing steps on my other instructables.

https://www.instructables.com/id/R-E-L-a-Y-D-U-I-N-...

https://www.instructables.com/id/Arduino-Just-Clone...

Step 11: ADDING LCD 16*2 DISPLAY...!

/* ----------------------------------------------------------------------------

----------------------------------------------------------------------------

---------- LCD 2x16

----------------------------------------------------------------------------

01 - VSS (GND)

02 - VDD (+5V)

03 - Vo (R = 1K Ohm to GND)

04 - RS (pin 8 in this ex.)

05 - RW (GND = LOW = write mode)

06 - EN (pin 9 in this ex.)

07 a 10 - D0 a D3 (connected to GND in this ex.)

11 a 16 - D4 to D7 (pin 0 to 3 in this ex.)

15 - LED+ (R = 470 Ohm to +5V)

16 - LED- (GND)

---------------------------------------------------------------------------*/

void setup()

{

lcd.pins(0, 1, 2, 3, 4, 5, 0, 0, 0, 0); // RS, E, D4 ~ D8

// LCD format

lcd.begin(16, 2); // cols, lines, [dotsize]

lcd.home(); // 0, 0

lcd.printf("PINGUINO PROJECT");

lcd.setCursor(0, 1);

lcd.printf(">INSTRUCTABLES<");

}

void loop()

{

}

Be the First to Share

Did you make this project? Share it with us!

Recommendations

  • Lamps and Lighting Contest

    Lamps and Lighting Contest
  • Back to School: Student Design Challenge

    Back to School: Student Design Challenge
  • 3D Printed Student Design Challenge

    3D Printed Student Design Challenge
Sours: https://www.instructables.com/Pinguino-Project-a-PIC-Microcontroller-Based-Ardui/

Arduino vs. PIC

The lighter ones only has 6-8 analogue input channels. What suggestions do you have? Is it possible to buy 2-4 pieces of the smallest and lightest Arduino and somehow sync them together so that they act as if they were one?

I'd generally try to avoid that unless I needed "multi-tasking" with each Arduino processing it's own data, or if there was an advantage to having them physically separated, etc.

And, I think 2 Unos are about the same size as one Mega.

If you have the capability, you can make a custom-smaller PC board.

Engineering involves, trade-offs, compromises, and decisions... You get to make those decisions!

Arduino vs. PIC

I've never used the PIC in a hobby project. But where I work we have a couple of PICs in our products. One of them (I think it' 8-bits) is just basically being used as a bootloader, and the other one is the main processor in the product (I think it's 32-bits).

The things that attracted me to the Arduino:

  1. It's on a board. I don't have to make a PC board or use a breadboard for the core CPU.

  2. The board is also the development kit. Nothing else to buy!

  3. The board (and the bootloader) is also the programmer . Nothing else to buy!

  4. The IDE/compiler is free.

(The Raspberry Pi and other "single board computers" have these same advantages.)

Also, I've used several IDEs/Compliers over the years (for programming computers & various microcontrollers). My usual goal for 1st day is to get the IDE/Compiler installed and configured, and to get "Hello World" running. If I can get that accomplished in a half-day or less, I'm very happy.

After I got my Arduino, it only took about 15 minutes to download and install the development software and get "Blink" running. That was amazing!

Sours: https://forum.arduino.cc/t/arduino-vs-pic/276066
  1. Verizon commercial lady
  2. Kenworth south florida
  3. Smartly napkins
(Last Updated On: September 9, 2021)

Arduino Vs PIC Microcontroller:

Arduino Vs PIC- In this article, we will compare the PIC Microcontroller with the Arduino Board which is based on the Atmega328 Microcontroller. For the best understanding first I will explain what is PIC Microcontroller, its pin description and then I will explain the Arduino board. Finally, in the end, we will compare the Arduino and PIC Microcontroller.

PIC Microcontroller:

The PIC microcontroller is a family of microcontrollers manufactured by microchip this means that the microcontroller IC is a product of a microchip. If you analyze this name PIC we get P for peripheral, I for the interface, and C for the controller. So full meaning of PIC is the peripheral interface controller. Now i will give you an example so that you can understand the main reason behind the PIC name. So, first of all, suppose you want to turn on and turn off the lights and fans using the computer keyboard buttons “A” and “B” but how is this possible because the keyboard is an analog device and the computer is a digital device this is possible if you use a third device as a unit and this device is a PIC microcontroller. This device acts as a unit between the keyboard and computer. The pic microcontroller connects and controls the computer and keyboard with the position between them. First, we will see the family members of PIC microcontrollers the PIC microcontroller product family currently consists of 6 groups. Now I will tell you the names of six groups of microcontrollers. So first one is PIC 10FXXX this microcontroller can take 12-bit program work, the second one is PIC 12CXXX or PIC 12FXXX this microcontroller has 12 or 14-bit program memory, the third one is PIC 16C5X this microcontroller also can take PIC program word, the fourth one is PIC 16CXXX or PIC 16FXXX microcontroller of this model can take a 14-bit program, the fifth one is PIC 17CXXX and this microcontroller can take 16-bit programmer and the last one is PIC 18CXXX or PIC 18FXXX and this microcontroller can take 16-bit programmer. This XXX means you can use three numbers in the XXX space as the name of the model serial.

Now I introduce you to the PIC 16FXXX microcontrollers family members. so the first IC is PIC16F84 or PIC16F84A this kind of IC has 18 pins then the second one is PIC16F88 and this also has 18 pins then the third one is PIC16F72 or 16f73 and this IC has 28 pins and the fourth ic is PIC16F877 or PIC16F877A and this has 40 pins. This IC is currently the largest IC in this PIC series.

Pin Description:

Now we will discuss the pin description of PIC16F877A. It is CMOS flash-based 8-bit microcontroller based on the microchips powerful PIC architecture.

Arduino Vs PIC

It has a total number of 40 pins out of which Port A has 6 pins, Port B, Port C, and Port D has 8 pins each, and port E has 3 pins. So from Port A to Port E, we have a total of 33 input and output pins. After that, we have two pins of VDD, two pins for VSS, one pin for MCLR which is the master clear pin of the microcontroller. Then we have one pin for OCS1 and one pin for OCS2 where the OCS1 is the oscillator input and OCS2 is the Oscillator output. These are the pins where the crystal oscillator is connected. The PIC microcontroller also consists of special pins like the RX and TX. The RX is serial input and TX is serial output.  Together these two pins are used for asynchronous serial communication with the serial devices. After that, we have SCL and SDA pins where the SDA is serial data and SCL is a serial clock. These two pins from the two-wire I2C or integrated circuit of the PIC microcontroller. Then we have the four pins SD0, SDI, SCK, and the SS Pin. These four pins form the SPI or serial peripheral interface of the pic microcontroller. Now from AN0 to AN7, we have 10 bit ADC the analog to digital converter. Then we have RB0 which is the external interrupt pin for the pic microcontroller. CCP1 and CCP2 are the two PWM modules. PC0 to PC7 we have the parallel slave port with external read-write and CS control. The parallel slave port is 8 bit.

Arduino:

An atmega328 microcontroller is manufactured by ATMEL making you input voltage of around 7 volt or 12 volts to this port. The operating voltage of the microcontroller is 5 volt it has a CPU speed of 16 megahertz. There are analog inputs or output pins that are 6 in number.

Arduino Vs PIC

There are the 14 digital input/output pins out of which 6 can be used for pulse width modulation. The major feature of this pulse width modulation is it can be used to vary the intensity or the speed it has a EEPROM of 1 kb SRAM of 2 kb flash memory of 32kb which can be used to store the program or load the program. UART universal a synchronous receiving transmission of 1 USB type is regular it has a reset pin which when pressed the program is going to start from the first line. The pin numbers A4 and A5 which are analog pins has SDA and SCL input which can be used to receive a real-time clock configuration when used with ds1307. The digital pins 0 and 1 are used for serial communication 0 for receiving and 1 for transmission pin number 2 and 3 which is digital can also be used for interrupts purpose.

Atmega 328P description:

Atmega328 is low power CMOS 8 bit microcontroller based on enhanced AVR architecture. It has total number of 28 pins out of which 14 are digital output input pins from D0 to D13. It also has 6 ADC channels from A0 to A5 these form the analog to digital converter of the atmega328. It also has 6 pwm channels and two pins for XTAL1 and XTAL2.

Arduino Vs PIC

Two pins for ground. Pin number 7 and pin number 20 for VCC. Pin number 21 for analog reference. One pin for reset it low enabled input. So when this enabled go low the microcontroller reset and the program of the microcontroller also reset. One pin for RXD and one pin for TXD. The RXD and TXD form serial communication input of the microcontroller. The atmega328 also has some special pins like SCK which stands for serial clock, MISO stands for master input slave output, MOSI stands for master output slave input, SS stands for slave select. Together these four pins form serial peripheral interface of the atmega328. After that we have SCL and SDA which are the serial clock and serial data which form the I2C port of the atmega328. The operating voltage of this microcontroller ranges from 1.8V to 5.5V but typically we used 5V for this purposes. It can be combined with 16 Mhz Crystal oscillator along with 22pF capacitor to form the crystal oscillator circuit. We 32 KB of flash memory, 2KB of SRAM and about of 1 KB EEROM.

Arduino VS PIC:

Now we will compare the PIC microcontroller and Arduino UNO. First of all, Arduino is not actually a microcontroller it is a microcontroller board or development board. It has an AVR atmega328 microcontroller in it.  PIC microcontroller is a family of microcontrollers made by microchip. They are mostly sold as chips and we need to put them on a circuit board by a sap socket and a few cables also external programmers like pick it 2 or pick 3 are needed to program the microcontroller using MPLAB X IDE. The software has less libraries as compared to Arduino UNO.

Arduino Vs PIC

Arduino UNO is however is very cost-effective compared to PIC and it comes under open-source hardware cross platforms are also available as you can program it on Windows Linux and Mac while most of the pic microcontrollers are only programmable in Windows setup. The Arduino can be connected to the computer using a USB cable. Arduino has another microcontroller that acting as a programmer therefore it does not require an external device for programming. The programming environment is very easy to use even for beginners the library of examples is also present in IDE. So all you need is a USB cable Arduino software and Arduino board.

Arduino Vs PIC

The PIC microcontroller is a program and developed using MPLAB X software. The MPLAB X software is free tool such as Arduino IDE but you have to pick the compiler yourself. We need more tools for the pic microcontroller. While in Arduino we only need an Arduino board, Arduino software, and USB cable. Sometimes we do not need a USB cable because the software is in it.

PIC microcontroller features:

Operating Frequency48 MHz
Program memory32 Kb
Program memory (instruction)16 Kb
Data memory2 Kb
Data EEPROM256
Interrupt sources20
I /O portsPort A, B, C, D, E
Timers4
PWM modules1
Serial communicationMSSP, Enhanced USART
USB1
Streaming parallel portYes
10 Bit analog to digital module13 input channels
Comparators2
Packages40 pins PDIP

44 pin QFN

44 pin TQFP

Arduino features:

Operating Voltage5 V
Input Voltage7 – 12 V
Digital I/O pins14
Analog input pins6
DC current per I/O40 mA
DC current for 3.3V pin50 mA
Flash memory32 Kb
SRAM2 Kb
EEPROM1 KB
Clock Speed16 MHz
Timers4
PWM modules6
communicationSerial, UART, TTL, SPI

Architecture:

Both a 8-bit RISC platforms so the base architecture is the same. PICs are older so they have more heritages in terms of knowledge but are also older technology and are not doing well keeping up with newer hardware verses cost. AVRs are newer and run faster with more features and have a support of open source tools (like the GCC compiler) and have cheap tools like the Dragon programmer and debugger.

We will not notice any difference when we are connecting relay, buttons or led but when we will using  complex projects like hardware interfacing, data communication and large data processing, etc then we will feel the difference between the arduino and PIC. PICs have alot of legacy information out there but AVRs have cheap tools that make things easier (PIC does not have a good open source compiler AFAIK) which with code intensive projects can be helpful. This is why things like the Arduino platform can exist.

Which microcontroller is best?

The Arduino is best because it is user friendly as compared to the PIC microcontroller because if we want to load program in the Arduino we just click on the upload in the Arduino IDE while in case of PIC we will perform complex steps in order to upload the code in the controller also Arduino is helpful in complex projects.

Like this:

LikeLoading...

Sours: https://www.electroniclinic.com/arduino-vs-pic-microcontroller-everything-you-need-to-know/
How to Build PIC Programmer Using Arduino

Arduino as a Pic Programmer!

Hi everyone!

Here is my first version of my PIC programmer : program your PIC from USB! Cheap and easy!
Feel free to do what you want with this project, modify it, upgrade it publish it,… but just tell me what you’ve done so that I can share it with everybody :wink:

It works with PIC 16F628 but should work with most pic16F; if you can try at home leave a message so that I can list the working PICs here!

Here is the circuit you need to make :

You can change the resistor value between 330 and more.
Always RESET Arduino before putting 12V (I don’t know if we need to, but that’s just a safe practice)

And here is the code :

To program use your COM port, here are the commands :

To Do :

  • This only reads and writes to program memory on PIC, improve it to access DATA memory(=EEPROM)
  • Support more PICs

Supported PICs :(Your PIC is not listed here? Don’t hesitate to post a comment here so that I can add it!)
Most 16F pics should be supported

Don’t hesitate to tell me if it works with other PICs.


Latest updates :
03/03/2012 : updated C# prog + arduino code
24/02/2012 : uploaded new Software that writes to Prog memory and loads the Configuration Word, and uploaded the Arduino Firmware, which supports LVP (Low Voltage Programming) by sending ‘S’ just after RESET.
22/02/2012 : updated the C# code : you can now burn HEX file to PIC! (only program memory supported, not EEPROM and Config word)
21/02/2012 : added the reset command, and started to program a C# program to send HEX to PIC


Here is a 18f programmer : Arduino as a Pic18F programmer - High Spark Special thanks to kirill578!

Enjoy,
Soranne

Sours: https://forum.arduino.cc/t/arduino-as-a-pic-programmer/90967

With pic arduino

Arduino based PIC Programmer

Program a PIC microcontroller with an Arduino? Yes! And not just because we can, but because it’s easy to build and program stuff with Arduino.

BUILD TIME: 1-1.5hrs
DIFFICULTY RATING: advanced

Many years ago, when computers had parallel printer ports, you could interface directly to the hardware, and a PIC programmer was not much more than a few passive components that pushed data straight onto the chip. With a setup like this, a PIC was the accessible microcontroller choice like Arduinos are today, and many circuit designs could be found on the early internet.

Nowadays, there are USB solutions for PIC programming like the PICkit 3 (Updated to PICkit 4), but if you want something a bit more bare-metal (and cheaper too), it’s a case of DIY. So in the spirit of the PIC programmers of old (say 10 to 15 years ago), I decided to build something myself, and along the way, I learned a lot about how the PIC programming protocol works at a low level. So far, the programmer works with the 12F675 of the PIC Pocket Remote Control and the ubiquitous 16F84A.

I wanted to design a simple-to-build PIC programmer for the 12F675 PIC, so that it would be easy for people to build the PIC Pocket Remote Control project, and what I’ve ended up creating is a breadboard (or protoboard –it’s simple enough to be built on a breadboard or protoboard) that, when combined with an Arduino compatible board does the job of the “K150” type programmers, which can be found online these days. These appear to be clones of the programmers originally produced by a company called “Kitsrus”.

I got myself one of these with the idea of refreshing my knowledge of PIC microcontrollers, but quickly found driver issues related to Windows 10 and (apparently) counterfeit USB-Serial ICs.

In short, I was able to get it working on my 10-year-old laptop running Windows XP, but I wanted something a bit more future-proof. There are online guides to building your own version, but they usually start with “take a blank PIC 16F628 and the PIC programmer you already have”, (which sounds a bit like some recipes for building 3D printers). The program that is used with the K150 programmer is basic but works for uploading HEX code, so I set out to emulate the function of the programmer board, which includes a working USB-Serial link (included in our Arduino at no extra charge!), some extra components to get our signals in the right place, and of course, an Arduino sketch to make it do all the things a programmer should.

I found there were two sides to the final sketch that runs on the Arduino – the bit that talks to the host program on the PC, and the other bit that interfaces with the PIC itself to perform the programming. I was actually able to get the two halves working independently, first convincing the host program that a programmer is attached, then making sure I could talk to the PIC and understood the programming process. What followed was an interesting exercise in reverse engineering.

arduino host program

The host program “MicroPro” allows you to do such things as load a HEX file, program it onto the PIC, read the HEX file back out and set the configuration fuses. If you’re only familiar with programming Arduinos so far, this is a bit of a different process, but only so far as the Arduino IDE is actually doing all this in the background when you click “upload”.

The first thing I found with MicroPro is that it only supports COM ports up to number 9, so I had to renumber my COM ports in Device Manager to make sure that it could work. I found a document describing the software protocol that is used and also the schematic of the K150. I was pretty sure that the K150 clone I had was not the same as the schematic, but it was close enough that I was able to work it all out. Initially, I soldered some header pins onto the serial communication pins to see if I could eavesdrop on the data to see how it matched the protocol.

Arduino compatible Mega

The pins are wired up to an Arduino compatible Mega, and a sketch (Mega_hex_transceiver_19200) is loaded that listens on the Mega’s Serial1 RX and Serial2 RX pins, allowing the command and response sequence to be captured. This is important as our Arduino based programmer needs to be able to fool MicroPro into thinking a real programmer is connected. In any case, I found that the protocol spec had a few small deviations, but was mostly accurate.

TXRX
x50-
x03x50
x04-
x00-
x00-
x40-
x06-
x00-
x50-
x02-
x00-
x01-
x01-
-x49
x14-
-x03
x04-
-x56

The next step was to create a sketch that fools MicroPro into thinking there is a programmer connected. Later on, this would be fleshed out with various functions that actually interact with a connected PIC. I even emulated the flash memory of the fictional PIC by storing data in the Arduino RAM. This was the “PICPGMdummy5” sketch, and it wasn’t quite complete, but it was close enough that I could start working towards a functioning version. The core of this sketch is a large ‘switch/case’ structure which detects which command MicroPro is sending and then jumps to a subroutine which may take extra parameters or return data before going back to wait for the next command.

Thus far, I hadn’t needed to build much hardware except for adding on the header pins to attach K150 to the Mega. Now I needed to build a circuit to interface the Arduino to the PIC. One thing that is very different about programming PICs is that they need a programming voltage of around 13V applied to one of their pins to correctly enter programming mode, so I needed a way of generating and switching a 13V supply with an Arduino. Because there is very little current needed at the programming voltage, I settled on using a voltage tripler circuit called a charge pump based on capacitors and diodes, and then switching the 13V with an opto-isolator. The other pins use normal 5V digital logic, so were simply connected to the Arduino pins via resistors. The PIC’s data pin changes from an input to an output during use, so I simply used two Arduino pins, one for the input function and one for the output function, with the resistors providing enough isolation to set and read the pins without constant changing the Arduino pins between inputs and outputs. If the PIC data pin is an input, it follows whatever is on the Arduino output pin, while if it is an output, it drives the input pin, and the resistor between the two output pins means that they are not trying to “fight” each other.

The voltage tripler needs a continuous stream of two out-of phase square waves to drive it, and I was able to generate this by using the PWM output on pins 9 and 10 on the Uno, with a little tweak to the code to create an out-of-phase signal instead of the normal in-phase signal that would be created. This is why this project may not work on other Arduinos, as the hardware timer is specifically attached to these two pins, but only on the UNO. This sort of circuit can be extended to more stages to create an even higher voltage, but with a decreasing current capacity. The tripler circuit makes up the left half of the circuit up to the third capacitor.

In an ideal scenario, the first capacitor is charged up to 5V via the first diode when D9 is low, then when D9 goes high, the first capacitor is lifted to 10V at its positive end, and so forth down the line, with each stage adding 5V. Extra stages can be added using two waveform pins, as long as they alternate. The actual result is 15V less whatever voltage is lost across the diodes and bled from the last capacitor from the circuit it is connected to. In practice, using Schottky diodes (because they have a lower forward voltage than silicon rectifier diodes), I was getting around 14V. I tried it with silicon rectifier diodes, and was only getting about 11V, which was not high enough according to the specs.

The output from the tripler is switched by an opto-isolator, where the output of the opto-isolator is also pulled to ground by a resistor to ensure there is no residual voltage when it is switched off. The 100kΩ and 10kΩ resistor form a voltage divider to monitor the tripler’s output via an analog pin on the Arduino, and are needed because they are measuring a voltage above 5V.

After the opto-isolator is the interface to the PIC itself, with some of the Arduino’s digital pins connecting to the PIC directly or via resistors. The ‘ICSP’ stands for In Circuit Serial Programming, and is used mostly because it is fairly standard to many of the programmers I have seen, although most applications will use an IC socket for out-of-circuit programming. To achieve this, I created a breakout board, which has an IC socket and a header for the ICSP signals. If I need to work with different PICs, it’s as simple as creating a breakout board with ICSP header that suits. A bonus is that the breakout board will work with any programmer that has an ICSP header, which most seem to do.

The programming protocol is well documented, and consists of 6-bit commands mixed with 16-bit data, with some commands sending and some receiving data. I tested this with the Manual_PIC_ProgrammerV2 sketch, which implements these commands and can be controlled via the serial monitor. For example, to read the program data of a 16F84A, the sequence “c04rc06” is entered, which performs command 4, which reads in the data that the command produces, then issues command 6 to increment the address to the next memory location. Repeating this sequence will slowly dump the program memory contents to the serial monitor. Using this, by manually entering various combinations of commands, I was able to determine the correct sequence of commands to read and write memory and also to write to the configuration fuses.

So far I’ve worked out the programming for 12F675 and 16F84A PICs, and the current version of the Arduino based PIC programmer supports these. Some PICs use different commands for different functions, which is part of the difficulty in building a universal programmer.

figure 1
figure 2
schematic for build

You will also need standard prototyping hardware, such as breadboard and jumper cables.

It’s assumed that you have a 12F675 or 16F84A PIC to program for a project that is being built, or at least to experiment with. I found an 8-pin IC socket was handy for the case of needing to move the PIC from the programmer to the circuit it is used in. The machine-pin-type sockets are a better fit for breadboards, and I ended up using a machine-pin-type socket on the breadboard and production type socket attached to the PIC to protect the pins when it is moved to the test circuit. ››

The actual construction is simple enough to be done on a breadboard, although I’ve also built a version on a protoboard to make it more permanent. I found it was easiest to build the circuit from left to right according to the diagram, testing the steps along the way. The tripler is the first module, consisting of the three left most resistors, capacitors and diodes. This part can be tested with this snippet of code (in the setup() part of an Arduino sketch):

  analogWrite(9,127);
  analogWrite(10,127);
  TCCR1A=0b10110000|(TCCR1A&0b00001111);

The remainder of the circuit is mostly built around the opto-isolator to switch the programming voltage on and off, and some resistors to feed the programming signals to the PIC. In the photo, there is both an ICSP header and an IC socket for a 12F675, which is why it looks like there may be too many wires.

inset

Apart from D9 and D10, the other pins can be reassigned if necessary, and of course reading the tripler voltage needs to be done by an analog input. At this stage, the Manual_PIC_ProgrammerV2 sketch can be used to test that the pins are being controlled correctly – for example, the ‘~’ command is used to toggle power on and off.

If you haven’t already done so, download and install the K150 MicroPro software. The final sketch code is a combination of the Manual_PIC_ProgrammerV2 and PICPGMdummy5 sketches, and is called “PICPGMFunctionalV7” (yes, there were a lot of versions of three different programs!), with some tweaks to round out some features. After setup sets up the pins, starts the charge pump and waits for it to get above 12V, the main loop waits for a command and then parses it with a large switch/case structure.

void loop() {
  int a;
  if(Serial.available()){
    a=Serial.read();  //if a command is received
    parsecommand(a);  //action it
  }
}
void parsecommand(int n){
  switch(n){
    case 0: break;
    case 1: Serial.write(‘Q’);break;
    case 2: do2command();break;  //echoes back next byte
    case 3: do3command();break;  //get Prog Variables
    case 4: do4command();break;  //V on
    case 5: do5command();break;  //V off
    case 6: do6command();break;  //cycle V
    case 7: do7command();break;  //program ROM
    case 8: do8command();break;  //program EEPROM
    case 9: do9command();break;  //program ID & Fuses
    case 10: do10command();break;  //write calibration/fuse
    case 11: do11command();break;  //read ROM
    case 12: do12command();break;  //read EEPROM
    case 13: do13command();break;  //read config
    case 14: do14command();break;  //erase chip? actual 14 appears to be missing, so all are off by one
    case 15: do15command();break;  //erase check?
    case 16: do16command();break;  //erase check EEPROM?
    case 20: do20command();break;  //out of socket detect, not implemented
    case ‘P’: Serial.write(‘P’);break;  //stay in programming mode...
  }
  return;
}

The individual commands are then customised to handle the particular functions. Command 12 is for reading the data (not program) EEPROM, and fortunately, the same 6-bit command performs a read on both 12F675 and 16F84A. The eepromsize variable is sent by MicroPro via an earlier command 3, and MicroPro knows this from the PIC which is selected.

void do12command(){   //read EEPROM from chip
 unsigned int d;
 for(unsigned int i=0;i<eepromsize;i++){
  sendcmd(5);   //init read from data mem
  d=readdata();   //read
  Serial.write(d&0xFF);  //only send 8 bits
  sendcmd(6);  //increment
 }
}

Once the hardware is built, upload the “PICPGMFunctionalV7” sketch to the UNO and connect the MicroPro app to the programmer by choosing the correct COM port. Select a PIC type appropriate to what is being used, and then you can test the response of the programmer without a PIC connected – the memory locations will be read as zeros. If the MicroPro app can at least complete these operations without complaining about a problem with the programmer, then it is time to connect a PIC and test that a HEX file can be uploaded and read back.

From time to time I found that MicroPro complained about the programmer being disconnected, but allowing it to perform a reset seems to do the trick. If the programmer doesn’t seem to be responding at all, check that the charge pump is reaching 12V, as the program waits during setup for this to occur – it should normally take less than a second. If you’ve been waiting to build the PIC Pocket Remote Control, it should be as simple selecting the 12F675 under chip selector, use the file menu to open the HEX file, and then click program to upload the HEX to the chip.

I would like to update the Arduino code to support the 16F88 and 16F628 PICs, the former because it is an updated pin-compatible version of the 16F84A, and the latter because it is used in the K150 clones, meaning that I can make my own version, perhaps using an Arduino type USB-Serial converter module and a similar set of components to the Arduino based PIC programmer. There are even design files for the PICkit 2 programmer available online, so if I can configure the programmer to work with the 18F series PIC that’s used in the PICkit 2, then I can work towards building my own version of these.

As I’m working on compatibility with further PICs, I have built a protoshield version, which can sit directly on top of the Uno, making for a quite compact programmer. It even has separate 8-pin and 18-pin sockets for different types of PIC. A further refinement will be the addition of an ICSP breakout board with a ZIF socket (as seen on the K150 board I bought) to make it easier to program multiple chips.

One of the features of the PICkit series of programmers is a “programmer-on-the-go” mode, which can allow the target PIC to be programmed without being connected to a PC. Given that the Arduino has more flash memory than many of the smaller PICs, it should be possible to add this feature, or even add a display and SD card slot to allow selection, loading and programming of different files in the field. In this case, the MicroPro program becomes unnecessary.

Another feature of the PICkit 2 is the ability to control ICSP power and behave as a logic analyser, allowing testing of the target PIC without removing it from the programmer. Although MicroPro does not have the means or commands to control power, a simple switch on the protoshield version should be enough to switch between programming and testing mode.

breakout
schematic

Because I’ve been working with PICs for a while, I already had a breakout board that I had built – something similar to this could also be done on a breadboard, as it’s not much more than a bunch of connections to suit the PIC that’s being used. In this case, because there is space, I’ve built breakouts for the 12F675 and 16F84A on the same board, with the 12F675 breakout being the small eight-pin socket. Note how one pin is marked on the six-pin header – this is always the VPP pin. Also, note the fact that it’s a six-pin header when it only needs to be five-stem from the layout that Microchip uses on its PICkit programmers.

The important information we need to build the breakout is found in the PIC datasheet; in this case, the IC pinout diagram above can also be found in the 12F675 programming specification. Apart from making sure we know where pin 1 is (if we align the notch on the IC socket with the notch on the diagram, we should be fine), we also need to work out which pins on the PIC correspond to which pins on the ICSP header.

For VPP, VDD and VSS this is easy enough. VPP has other functions, but we can easily find that VPP is one of those functions. For PGD and PGC, it is not so obvious, but in this case, the pins who have ICSP in the name are the ones we need. So ICSPDAT is equivalent to PGD, and ICSPCLK is equivalent to PGC.

From there, it’s a simple case of running connections from the ICSP header to the respective pins. I’ve also added an LED and resistor to GP2 so that I can leave the PIC in circuit for testing.

As long as you have the datasheet for a specific PIC, you should be able to create an equivalent ICSP breakout board to suit it.

Sours: https://diyodemag.com/projects/arduino_pic_programmer
How to Build PIC Programmer Using Arduino

PIC vs Arduino

PIC vs Arduino

Difference Between PIC vs Arduino

The expansion of PIC represents the peripheral interface controller which is the term rarely used these days. Arduino is available as an open-source that is user-friendly in terms of both software and hardware. They belong to the family of microcontrollers. The working and architecture of Pic and Arduino have wide variations that are implied in a suitable environment according to the requirements. The key difference and comparison of Pic and Arduino such as definition, architecture, functions, applications, advantages, and limitations are explained in this article.

Head to Head Comparison between PIC vs Arduino (Infographics)

Below are the top 6 comparisons between PIC vs Arduino:

PIC vs Arduino (Infographics)

Key differences between PIC vs Arduino

Let us discuss some key differences between PIC vs Arduino in the following points:

1. Definition & History

Arduino is available as an open-source on electronics platform and has a software package used to program the hardware part. It is developed to make easily accessible for designers and hobbyists and student to create an interactive and live environment to implement many objects based on electronics and automobiles. The concept of Arduino is developed by Massimo Banzi which is easily programmable and simple to deploy. The term Pic is now as an expansion of programmable intelligent computer which is built in 1976 and implied in embedded systems.

2. Architecture

The processor board of Arduino is based on Harvard architecture. It has a separate memory for both program code and program data. The program memory comprises data storage and data memory whereas the flash memory program stores the data code. The 2kb of SRAM and 32kb of Atmega328 microcontroller. It has 1kb of EPROM which executes on the clock speed of 16MHz. The architecture of the PIC microcontroller comprises stack registers to save and returns the operation of Random Access Memory. The significant element of Pic is EEPROM, RAM, timers or counters, I/O ports, flash memory, CCP, USART, Comparator, SSP, PSP, ADC, ICSP, and LCD. It is also classified into four types such as PIC18, Baseline PIC, Enhanced mid-range PIC, and Mid-range PIC.

3. Operation

The working of Arduino has the digital read and write ping which is used to read and write the value of the input pin. The mode pin is used to configure the I/O mode. The analog read and write are used to read and write the value which is used to return and print the value of input data. The serial pin is used to configure the serial communication by configuring the bit rate. The pic is used to support the PDP computers to manage its external devices. The operation is very robust and simple to run a program when it is compared with other controllers. The architecture of Pic resembles Harvard architecture. It is user friendly and easily programmable by using flash memory.

4. Merits & Demerits

The Pic microcontrollers are adaptable and it is less prone to fault occurrence. The efficacy of the Pic is very robust as it involves RISC architecture. When compared to other existing microcontrollers it has minimum power consumption and an easily programmable interface. It is available in a cheap amount and provides simple interfacing to analog circuits. As Arduino is available as an open-source it enables the user to build their kit. All the operating system such as Macintosh, Windows, and Linux supports Arduino to develop the kit. It uses the Arduino code to combine the predominant programming language which can be edited and extended as per usage. It can be easily understood by beginners. It has a maximum code length of the pic controller as it is in RISC architecture. Here program memory of the Pic controller is not accessible and it has only one accumulator.

Comparison Table of PIC vs Arduino

The table below summarizes the comparisons between PIC vs Arduino:

AttributesPicArduino
DefinitionIt belongs to the traditional microcontroller family with its 8-pin structure.Arduino does not belong to the family of the microcontroller. It is based on an audio/video receiver and is built on its integrated development environment.
ArchitectureThe microcontroller Pic comprises of EEPROM, CCP, system service processor, program segment prefix, add with carrying segments, In-circuit serial programming processor and LCD.The Arduino comprises of 2kb of SRAM and 32kb of flash memory.
Power SupplyIt operates on 5v to 6.6V.The power supply of Arduino lies between 6V and 20V. It is recommended to use 7 to 12V should be provided through the direct current with parallel jack current using Vpin.
ApplicationsIt is implemented in simple toys, control systems, remote controls, power tools, and automatic engines.It is used in smart home applications, electronics, and automobile automation devices and IoT equipment.
AdvantagesIn the advanced form of Pic, multitasking is available, and it operates as a strong and robust processor. It can also be used in ports of ethernet, WIFI, Bluetooth, audio and video output, USB ports, camera ports, and other HDMI ports. Simple coding is also possible for the functioning of electronics. It can also be used to connect multiple components online to accomplish tasks simultaneously.It is easy to implement in analog components, automatic engines, sensors, and other automobile and electronic automation devices. The different architecture can add many functionalities to devices. It doesn’t require any complex or longer code just a plugin is enough to execute a program. It can be deployed easily to establish many online functions that require many sensors.
DisadvantagesIt operates on lengthier code and needs an extra plugin to connect peripheral hardware devices. Special programs are fed to execute any simple actions.It can execute only one code at a time if it runs any multiple codes, the system becomes slow. It is a huge learning curve which requires a piece of knowledge on C/ C++.

Conclusion

The Arduino can be implemented in robotics, electrical appliances based on IR, smart home automation, the fault recognition use in an underground cable. The pic microcontrollers are used in industries as it consumes only low power. It provides maximum efficiency and easily accessing methods to support software and hardware tools such as simulators, debuggers, and compilers.

Popular Course in this category
All in One Data Science Bundle (360+ Courses, 50+ projects)360+ Online Courses | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (3,220 ratings)

Data Scientist Training (76 Courses, 60+ Projects)Tableau Training (4 Courses, 6+ Projects)Azure Training (5 Courses, 4 Projects, 4 Quizzes)Hadoop Training Program (20 Courses, 14+ Projects, 4 Quizzes)Data Visualization Training (15 Courses, 5+ Projects)

Recommended Articles

This is a guide to PIC vs Arduino. Here we discuss the PIC vs Arduino key differences with infographics and comparison table. You may also have a look at the following articles to learn more –

  1. How Does Collection Method Works in MongoDB?
  2. MongoDB Alternatives | Top 8
  3. Lookup in MongoDB With Characteristics
  4. MongoDB Limit() | How to Works?
Sours: https://www.educba.com/pic-vs-arduino/

Now discussing:

Arduino Like IDE for PICs

Before the Arduino become popular, PICs was the go-to microcontroller device for most electronic hobbyists. PICs were cheap and the resources (at that time) were plenty. But then Arduinos came, which offer a much simpler way to code and so only few now use these microcontrollers. Arduino's strength relies on it being a development platform rather than a single-chip microcontroller. Its creators have managed to create a system that makes things work on a simple and less time consuming way. I am a PIC fan but most of the time I would opt to use an Arduino because of how easy it is to code, upload and connect stuff. With this in mind, I tried looking for Arduino Like IDE for PICs. Here's what I found.

Pinguino

Pinguino is an open-source Arduino-like development platform that uses 8-bit or 32-bit PICs. The 8-bit Pinguinos feature 18F PICs while the 32-bit version showcases the PIC32MX . They have their own IDE but the coding is very much the same as with the Arduino. Here's some screens from their IDE:

arduino like ide for pics - pinguino 1

arduino like ide for pics - pinguino 2

The 18F4550 Pinguino has 29 digital input/output with 8 shared analog inputs, UART for serial communications,
2 fast PWM output ( 3000 Hz ), and 8 analog inputs. However, the board picture above seems to not use all the mentioned pins in an effort to follow the Arduino's form factor.

There's no official Pinguino board and I have found a number of versions. Here are some of the iterations:

The Pinguino wiki has all the information you need to build your own device. I'm planning to build my own Pinguino some day and might write about it here.

chipKIT

arduino like ide for pic - chipkit uc32

The chipKIT boards was introduced by Microchip and Digilent way back 2011 to introduce 32-bit computing to the Arduino platform which was non-existent at that time. According to their official website, there are now 25 chipKIT-compatible boards available in the market.

All of those 25 chipKIT boards feature the PIC32MX microcontroller. The chipKIT hardware itself is open-source but the official programming tool, named chipKIT PGM, is based on a licensed design (i.e. not free).  However there are non-official programmers that you can clone without issues.

The chipKIT boards uses their own IDE, named MPIDE, which thankfully is also open-source. This IDE is much more Arduino-like than Pinguino's IDE:

arduino like ide for pic - mpide

All boards use 3.3 V logic levels but all digital pins are said to be 5V tolerant. Also worth mentioning is that the number of PWM pins is less than the Arduino.

Head over to ChipKIT's official website if you want to have one of these boards. The UC32 board (pictured above) will cost you 29.95 USD as of this writing.

CIKU

CIKU is a PIC184550 Arduino-like board designed by Malaysian company Cytron Technologies. The board is designed very much like an Arduino UNO. The user can access 20 digital I/O pins, 6 of which are also analog pins and 2 PWM pins.

arduino like IDE for PICs - ciku

This board doesn't have its own IDE and uses Microchip's MPLAB X IDE. You can code the CIKU like an Arduino board by including "Arduino.h" as one of the headers. The core compiler used is XC8, which means you will have to deal with the limitations of C (Arduino uses C++).

The CIKU is not open-source and is available for a price of around 16 USD.

Sours: https://www.teachmemicro.com/arduino-like-ide-for-pics/


145 146 147 148 149