BasicMicro - Forums

www.basicmicro.com
It is currently Sun May 20, 2012 10:56 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Compiles in v2.2.1.1 but won't in v5.3.1.0
PostPosted: Mon Sep 22, 2008 4:54 am 
The program below compiles and runs just fine in v2.2.1.1 but generates compiler errors if compiled with v5.3.1.0. Apparently the DIG statement is the offender, but it's a legal usage as far as I can tell.

The program simply reads an A/D pin on an ATOM28 module, and lights an LED if result is below a threshold.

Can anyone shed any light?

Code:
'******************************************************************************
'
'This program is the low battery voltage and runs on the Atom microcontroller
'from BasicMicro Inc.
'
'******************************************************************************
'
'
'******************************************************************************
'
'
'******************************************************************************
'
'Define variables & constants
'
'******************************************************************************
'
i            var   word      'for-next loop variable
x            var   byte      '
Temp1         var   word      'General purpose variable
Temp2         var   word      'General purpose variable
Temp3         var   sword      'General purpose variable
'
A2D_Clk         con   2         '
A2D_sample      var   long      '
VBAT         var   long      'adjusted battery measurement
VBAT_INT      VAR   BYTE      'integer portion of VBAT variable
VBAT_DP         VAR   BYTE      'decimal point portion of VBAT variable
'
'******************************************************************************
'
'Assign pin aliases (Note: 1st character cannot be numeric)
'
'******************************************************************************
'
KbdData         con   P0         '
SCL          con   P1         '
KbdInt         con   P2         '
SDA            con   P3         '
KbdAck         con   P4         '
BalAft         con   P5         '
TrSensor      con   P6         '
BalFwd         con P7         '
'
LCD_TX         con P8         '
ClkInt         con   P9         '
MrSensor      con   P10         '
Wheels         con   P11         '
Alert_LED      con   P12         '      
COP_LED         con   P13         '
W1            con   P14         '
SpareIO         con   P15         '
'
'A2d pin      con   ax0         'A2D input pin
RPM_horn      con   ax1         'RPM horn output
TP2            con   ax2         'gen purpose test point
SeatSensor      con   ax3         'seat sensor input
'
INPUT   AX0               'VBAT ANALOG INPUT
OUTPUT   AX2               'LOW ROTOR RPM HORN
'
'******************************************************************************
'
'Establish initial variables. Note: Number of sensors exceeds number of display
'pages. Some display pages have no specific sensor (SLIP), and some sensors have
'no uniquely associated display page (Seat Sensor).
'
'******************************************************************************
'
'
'******************************************************************************
'
'******************************************************************************
'
Low   RPM_horn         '
Low   SpareIO            '
Low   KbdAck            '
Low   SpareIO            'diag use only
Low SCL               '
'
'******************************************************************************
'
'
'******************************************************************************
'
Main_Loop:
'
'
'******************************************************************************
'
'Check parameters
'
'******************************************************************************
'
gosub   CheckVbat         'Check battery condition
'
goto   Main_Loop         'resume battery check loop
'
End                     ' Done. End program
'
'******************************************************************************
'
'Check Battery voltage
'
'******************************************************************************
'
CheckVbat:
Adin   AX0,A2D_Clk,AD_RON,A2D_sample
A2D_sample = A2D_sample * 100   
VBAT = A2D_sample / 595
'
'Parse into integer and decimal point parts for easy LCD display
'
VBAT_INT = VBAT /10
VBAT_DP = VBAT DIG 0
serout s_out,i2400,   ["VBAT is ",dec VBAT_INT,".",dec VBAT_DP,13]
pause 250
'
if VBAT_INT > 12 then CheckVbat2   'Vbat good if Vbat_Int is 13 or above
'
if VBAT_INT = 12 and VBAT_DP > 5 THEN CheckVbat2 ' Vbat still good if greater than 12.5 volts
'
high RPM_horn   'batt low, keep horn on while batt low
serout s_out,i2400,   ["VBAT is low at ",dec VBAT_INT,".",dec VBAT_DP,13,13]
pause 250
return
'
CheckVbat2:
low RPM_horn   'batt good, keep horn off
return


Top
  
 
 Post subject: Re: Compiles in v2.2.1.1 but won't in v5.3.1.0
PostPosted: Mon Mar 30, 2009 12:32 pm 
I just updated our software to version 5.3.1.3 also and am having the same problem. Compiler error on ADIN statement. Compiles and runs fine on the older version. Updated for the newer Atom40D chip. Have not gotten any answer as of yet.

Mike Bronko


Top
  
 
 Post subject: Re: Compiles in v2.2.1.1 but won't in v5.3.1.0
PostPosted: Mon Mar 30, 2009 2:41 pm 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
My guess is that their new version is the same or closer to the pro version. In the example above, maybe it should be something like:
Adin AX0,A2D_sample

or maybe like: Adin p0, A2D_Sample

I mainly use the atom pro so not sure...

Kurt


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO