PDA

View Full Version : PIC BASIC Compiler pbc:- Help!



timmoore47
- 18th May 2006, 19:25
This is NOT the pro version. Its v 1.45

So far I've got this working for a 18F84A, using Micro Code Studio, however this is Day0 and I'm struggling. Code:-

Loop:

goto loop
end


Now it's easy to spot this does nothing useful. What I'm trying to do is import data from a bunch of switches and output to leds on port b.

Internet searches etc etc etc have yielded nothing useful for this product in the way of documention. Whilst I bought it yesterday as a download, all the docs folder has was pdf files of the chips themselves, so I am stuck!

(Update:- Since I posted this, I found http://www.melabs.com/resources/pbcmanual/ which looks OK. ) But just declating variable A ,B , C etc at the beginning of the program... well... the sytax has so far eluded me.....

Any code fragments or sources of beginners information as to how to get this, no doubt, fine product to do anything useful would be VERY gratefully appreciated!

:)

Tim

paul borgmeier
- 18th May 2006, 21:59
Tim,

Have a look here

http://www.melabs.com/resources/samples.htm

Toward the bottom, there is a section called - PICBASIC™ Compiler

Start with Blink

Good Luck,

Paul Borgmeier
Salt Lake City, Utah
USA

timmoore47
- 19th May 2006, 00:33
Tim,

Have a look here

http://www.melabs.com/resources/samples.htm

Toward the bottom, there is a section called - PICBASIC™ Compiler

Start with Blink

Good Luck,

Paul Borgmeier
Salt Lake City, Utah
USA

Many thanks, worked a treat but doesn't cover inputing data from portA or logical operators for data decisions. But it's a neat step forward.

:)

Tim

mramos
- 31st May 2006, 22:51
Timmoore47:

You will want to map port A and port B with the "symbol" command like:

Symbol PortA = 5

Then read it:

peek PortA,B0 'read PortA into Byte0 variable

If the LEDS are on port B, then map PortB with Symbol and Poke PortB,B0

Note the number of pins on PortA, you might not need to wire LEDs to all of port B.

timmoore47
- 1st June 2006, 09:20
Thank you. I'll try that out.

:)

Tim

dw_picbasic
- 5th February 2007, 17:58
Hi timmoore47,
How many switches?

I use 2 approaches.

If I have plenty of pins to use, I prefere binary switching to a pic as its fast and easy to implement.

If I am short of pins, I use POT or A/D.
For Pics that don't have A/D, I use the POT command.
I set up buttons in a resistive divider ladder.
Then I have the PIC talk to my PC serialy.
I press each button to see what the pic is getting for POT or A/D readings and then using those values, the next step is to code where to go in the rest of the program, based on these readings.
Hope this helps
dw_picbasic