PDA

View Full Version : Newbie question... why dont this work...??



shax
- 7th September 2005, 21:35
Hi all,
sorry if I appear to be a thicko newbie, but last week I bought Proton from Crownhill, and I am having a slight (?) headach trying to get my code to work!

For a project I am trying to get an RF module to run three very simple output routines.. flash led, make a sound, do both, etc...

I am using a 12f629, the code seems to compile ok, with no errors, but no matter what I try, the routines always seem to get stuck in a repeating loop. They never break out, or return to their respective gosub calls.. the chip is being programmed / erased with a PicKit1 doofer... Eventually I want to use the rfPIC12F675f

I know I am doing something REALLY stupid, but any comments would be a help.. and I'd like to get this sorted before I commit to making some pcb's!

Cheers in advance,
Shax.



'=================================
' project :
' author :
' date : 06-09-2005
' test device : 12f629
' revision : 0.02b test code
'=================================

Device=12F629 'define processor
Set OSCCAL
Config INTRC_OSC_NOCLKOUT, MCLRE_OFF ' internal 4mhz osc, MCLR internal


' setup ports
TRISB = %11000011 ' define port pin assignments
Symbol LED = GPIO.4 ' LED output on port 4
Symbol DATA_OUT = GPIO.2 ' DATA_OUT output on port 2
Symbol RF_ENABLE = GPIO.5 ' RF_ENABLE output on port 5

'NEXT BIT SETS PORTS IN INITIAL STATE
Low RF_ENABLE
Low LED
Low DATA_OUT

' define variables
Dim tx_delay As Word
tx_delay = 1000
Symbol max_delay = 15000
Dim reps As Byte
Let reps = 0
Dim warp As Byte

GoSub LOOP
GoSub Theme
GoSub loop2
' start of standby routine loop
LOOP:
For reps = 0 To 10
High LED
High RF_ENABLE
DelayMS 50
Low LED
Sound DATA_OUT,[120,12]
DelayMS 5
Sound DATA_OUT,[120,12]
DelayMS 50
Low RF_ENABLE
DelayMS 5000
Next
Return 'never gets here


Theme: Low RF_ENABLE ' i ripped this section from the proton samples to see what would happen... still dont work!
High RF_ENABLE
DelayMS 50
Sound DATA_OUT, [50,60,70,20,85,120] ' this is how far this routine gets ( if selected by first gosub) before repeating if selected!
Sound DATA_OUT, [83,40,70,20,50,20]
Sound DATA_OUT, [70,20,90,120,90,20]
Sound DATA_OUT, [98,160]
DelayMS 500
'-------
For warp = 128 To 255
Sound DATA_OUT, [warp,2]
Next
'-------
Sound DATA_OUT, [43,80,63,20,77,20,71,80,51,20,90,20,85,140,77,20,8 0,20,85,20,90,20,80,20,85,60,90,60,92,60,87,60,96, 70,0,10,96,10,0,10,96,10,0,10,96,30,0,10,92,30,0,1 0,87,30,0,10,96,40,0,20,63,10,0,10,63,10,0,10,63,1 0,0,10,63,20]
DelayMS 50
Low RF_ENABLE
DelayMS 10000
Return

loop2: 'never gets here, unless selected by first gosub
Low LED
High RF_ENABLE
Sound DATA_OUT,[50,12,60,12,70,12,60,12,50,12]
Low RF_ENABLE
Let tx_delay = tx_delay + 5
DelayMS tx_delay
If tx_delay > max_delay Then tx_delay = max_delay
GoTo loop2

rhino
- 8th September 2005, 01:14
..last week I bought Proton from Crownhill..Try posting your question HERE (http://www.picbasic.org/forum/). This forum is for Melabs Picbasic compilers.

shax
- 8th September 2005, 01:41
OOOPS... if I've posted in the wrong forum, my apologies....
But can anyone offer some advice other than "please go away and bug someone else"..?
All the bumf with the product shouts CROWNHILL.. so does the picbasic.co.uk website... Hmm.... picbasic.org AND picbasic.co.uk are both registered to Crownhill...ooops... silly me for putting 2 and 2 together and getting PI!!!

is there anyone out ther that can post a sensible reply to my question?

shax.

rhino
- 8th September 2005, 14:05
is there anyone out ther that can post a sensible reply to my question?
shax.I can't believe I'm replying to this again.... as I said earlier, this forum is for the Melabs Picbasic compilers. Yes it is Crownhill's site. Crownhill is a distributor of the Picbasic compilers. Crownhill also sells the Proton compiler, the one you have. My previous post gave you a link to their forum, where you should be able to find the answer to your problem with the product you have. So when you say
can anyone offer some advice other than "please go away and bug someone else"..?I've given you a place where there are folks with experience with your chosen compiler which can provide the information you need.

rhino - excuse the dinky little edit - Melanie
Melanie - No problem... I understand - rhino

shax
- 8th September 2005, 15:42
Rhino,
I took your advice and posted on the Proton forum... got the info I needed..

Thanks for pointing me in the right direction...

Sorry if I p155ed anyone off....

shax.