PDA

View Full Version : I am missing something, what is wrong with this code?



manta_z
- 18th March 2009, 01:38
I am using Picbasic 1.45
Microcode Studio 3.0
Using a 16F690.
Asm commands works fine, but nothing in basic.

I always get errors on VAR, CON defines, etc.

The sample blink program is the only one that seems to compile without errors.

This is nuts. What am I missing?

Here is my exact code snippet.

asm
Include "P16F690.INC"

@ DEVICE PIC16F690,INTRC_OSC_NOCLKOUT ' internal RC osc
@ DEVICE PIC16F690,MCLR_OFF ' Disable external MCLR
@ DEVICE PIC16F690,WDT_OFF ' Disable WatchDog timer
@ DEVICE PIC16F690,PROTECT_OFF ' Disable device protect
@ DEVICE PIC16F690,CPD_OFF ' Disable Code-Protect
@ DEVICE PIC16F690,PWRT_ON ' Enable Power-up timer
@ DEVICE PIC16F690,BOD_ON ' Enable Brown-out detect

endasm

SYMBOL PORTA = 5
SYMBOL PORTB = 6
SYMBOL PORTC = 7
Symbol TrisA = 133
Symbol TrisB = 134
Symbol TrisC = 135

poke TrisA, 255 ' Set PortA to all input
poke TrisB, 255 ' Set PortB to all input
poke TrisC, 255 ' Set PortC to all input

CALL BLINK_THREE

main:


IF bit5 = 0 then jump1

'do something

jump1:

IF bit4 = 0 then jump2

' do something

jump2:


goto main


BLINK_THREE:

poke PortA, 2
pause 100
poke PortA, 0
pause 100
poke PortA, 2
pause 100
poke PortA, 0
pause 100
poke PortA, 2
pause 100
poke PortA, 0
pause 100

return


END

Darrel Taylor
- 18th March 2009, 03:40
I am using Picbasic 1.45
Microcode Studio 3.0
Using a 16F690.
Asm commands works fine, but nothing in basic.

No, I don't think the ASM lines are working ...
The @ symbol is not supported with PBC. But they're inside an ASM block anyways. @ is not valid in ASM either.

I always get errors on VAR, CON defines, etc.
Those statements are not valid in PBC.
You have to use Symbols, Peeks and Pokes.


The sample blink program is the only one that seems to compile without errors.
This is nuts. What am I missing?
I think you're missing that any example you find on the Internet for PicBasic, will actually be for PicBasic Pro.

They are completely different languages.
Most PBC programs will run with PBP, but the reverse is almost never true.
<br>

manta_z
- 26th April 2009, 22:46
Hey how can someone be posting questions as me.
What the?

This message was NOT posted by me yet has my name on it.

the real Z_manta!

Nice!!!!

Darrel Taylor
- 26th April 2009, 23:15
Well, that was your first day here ... (Joined March 17, 2009) St. Patrick's Day.

Each post is tagged with an IP address, and all of your posts were made through the same dial-up or dynamic ISP (qwest.net).

Maybe you just forgot about it?
<br>