PDA

View Full Version : im new and confuzed.



sirbow2
- 4th August 2011, 16:00
i have a 18f4520 and i didnt use it as i dunno how to use assembly, but then i heard about PICBASIC which allows me to use BASIC to program the PIC, right? ive used BASIC with my BasicStamp2, is this the same language with PICBASIC?

i know someone with a copy they didnt use, so they gave it to me, it is version 2.6 PLUS. which if i have done my research correctly, should work with my PIC.

so what do i do with the IDE and compiler etc? ive installed both PBP and Microstudio, so now do i just start BASIC programming in microstudio after loading the 18F4520.bas? then compile and program the PIC? do i jsut supply 5v and hook up the serial pins to my computer, or are their more steps to programming it?

so basically what do i do to get my PIC ready to be programmed

thanks

sirbow2
- 5th August 2011, 02:18
alright so i got my IDE all setup. :)

so how do i program the PIC? their has to be a bootloader on it first for usb or serial programming to work with out a special programmer chip. If i supply 5v, add a cap on pin 18 and hook up the D+ and D- pins with USB to my computer i could use that to transfer but only with a bootloader. what is the method to use Serail (rs232) with a bootloader? do i jsut connect TX and RX via a serial cable?

Heckler
- 5th August 2011, 04:09
One good way to program a PIC is to use an external programmer called a PICkit2 produced by Microchip. MELabs also makes a programmer module.

One MAJOR difference between a raw PIC microcontroller and a Basic Stamp module is that you have to set up each of the pins you want to use as an input, output, analog input, pulse width modulated output, etc. using the PIC registers. You will find out about these registers by reading the associated data sheet for the PIC you are wanting to use. These registers and the capability to define what each pin will do also make the PIC MUCH, MUCH more powerful and capable than the Stamp. They (PIC microcontrollers) are also MUCH cheaper, say $2 instead of $49, than the Stamp.

You might want to take a look at some of the example programs listed in the "projects" section on the home page of this forum (left side). Like > this (http://www.picbasic.co.uk/forum/content.php?r=374-How-to-read-a-one-wire-DS18B20-temperature-sensor-or-nine-of-them) < article (one I authored :D) about communicating with "one-wire" temperature sensors. You can also see the PICkit2 programmer in the article.

By studying others code examples you can see how they set up the various pins and registers on the PIC.

These registers can be overwhelming at first... you MUST have the datasheet for the PIC available to reference the register names and bits in order to correctly configure them in your program.

good luck and don't give up!

gadelhas
- 5th August 2011, 11:48
Hi;

I think you should follow the mister_e Beginners guide;

http://www.picbasic.co.uk/forum/content.php?r=56-Beginners

sirbow2
- 6th August 2011, 00:10
Hi;

I think you should follow the mister_e Beginners guide;

http://www.picbasic.co.uk/forum/content.php?r=56-Beginners

i could help but notice you ended the lines of your sentences with ; like in C++ etc :D

thanks for all the info!!