PDA

View Full Version : PicBasic Question (PIC16F84)



Dan_lay
- 18th July 2004, 10:34
I'm new to PIC programming and was looking to create a project I found on the web. (http://www.rentron.com/PIC16F84.htm) I have all of the components needed and have a PICStart Plus programmer with Microchip MPLAB IDE.

What I don't have is PicBasic, do I need to spend a lot of money purchasing PicBasic? or is there another way to compile my changes to the code?

Many Thanks,

Dan

Melanie
- 18th July 2004, 11:45
Go here...

http://microengineeringlabs.com/products/pbc.htm

click on the big 'CompileSpot' Button

This is good for simple programs only as it is limited and is intended as a "try before you buy". I can't tell you if that program on the Rentron site is too big or not - you may need to make some changes.

If you intend to play (or be serious) with PICs, or want to move away from 'toytown' Basic Stamp into a 'grown-up' world, then buying one of MeLabs compiler products (especially PIC Basic Professional) is recommended.

Melanie

Dwayne
- 20th July 2004, 15:16
Hello Dan,

I took a look at your code on the URL...

I used to use compile spot all the time. I now have PBP. 2.45. But I have no doubt that you can compile your project on compilespot... But you will have to do a couple of things in order for it to compile.

1. Remove *all* comments.
2. Change all the "If" statements to a case statement.
for your 12 "If relay"
3. Change your label ifs to if and else statements.


Compilespot only allows 900 bytes of "basic" program... not Assembly.

This means that you are limited to 400 characters. not words or variables or anything fancy. Shortening variable names from Relay1 to R1 saves you twice as much space. taking out all comments saves you tremendous space.


To do this, you gotta think and act like someone as me<g>(and there are worse folks than I <g>)...Do you know how the grand canyon was formed??? Somebody rolled a penny down a mole hole... <g>

Compilespot is excellent for learning and playing. I highly recommend it. I ended up purchasing the full version, but for 6 months I used Compilespot to get many different projects working.

If you need help, just ask... I will see what I can do...

Dwayne

Dwayne
- 20th July 2004, 21:56
Hello Dan,

I took the program and "compressed it" so that it will compile on compilespot.com. Here is the code...
do not add anything to it, and leave off the "End"
do not add spaces, comments, or anything else.

I am assuming the code I copied off that site runs.

It is 899 bytes... compile spot allows 900..

Dwayne



INCLUDE "bs2defs.bas"
r VAR b3
s VAR b4
se VAR PORTA.4
TRISA=$10
TRISB=$00
l:
SerIn se,N2400,[254],r,s
Select Case r
Case 1:
IF s=1 Then
High 0
Else
Low 0
EndIF
Case 2:
IF s=1 Then
High 1
Else
Low 1
EndIF
Case 3:
IF s=1 Then
High 2
Else
Low 2
EndIF
Case 4:
IF s=1 Then
High 3
Else
Low 3
EndIF
Case 5:
IF s=1 Then
High 4
Else
Low 4
EndIF
Case 6:
IF s=1 Then
High 5
Else
Low 5
EndIF
Case 7:
IF s=1 Then
High 6
Else
Low 6
EndIF
Case 8:
IF s=1 Then
High 7
Else
Low 7
EndIF
Case 9:
IF s=1 Then
PORTA.0=1
Else
PORTA.0=0
EndIF
Case 10:
IF s=1 Then
PORTA.1=1
Else
PORTA.1=0
EndIF
Case 11:
IF s=1 Then
PORTA.2=1
Else
PORTA.2=0
EndIF
Case 12:
IF s=1 Then
PORTA.3=1
Else
PORTA.3=0
EndIF
End Select
GoTo l

Dan_lay
- 25th August 2004, 23:45
Thanks loads! your help has been very useful!

Many Thanks,

Dan