lpc812 ACMP routines

Questions about the BASICtools and MakeItC
Post Reply
olzeke51
Posts: 394
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

lpc812 ACMP routines

Post by olzeke51 »

ACMP03.bas
(6.18 KiB) Downloaded 345 times
Hey , it works !!! my programmin is a little rusty (so are my fingers!)

ran in DEMO okay
connected the eval chip - but didn't connect my analog inputs - they are just floating

got this error - so took a screen dump of it.
is it serious??

have done several "resets" and reload files
and it all seems to work

I get this now:
Analyzing C:/Coridium/basic/BASIClib/ACMP03.bas
C:/Coridium/basic/BASIClib/ACMP03.bas:13:1: warning: "LPC812" redefined
<command line>:1:1: warning: this is the location of the previous definition
Programming Flash 0812...
ARMbasic[9.31a] on the PC Copyright 2014, Coridium Corp.
*+*+
... ( 0.46K code + 0.05K const)/4K 0.03/1K data programmed
Attachments
acomp03_error.GIF
acomp03_error.GIF (14.43 KiB) Viewed 11791 times



basicchip
Posts: 1038
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: lpc812 ACMP routines

Post by basicchip »

Your #define LPC812 in line 13 is causing the warning

BASICtools as part of reading vectors, takes the part number and creates the same #define that is inserted before any of the user code.

You can see this in %temp%/__temp.bas which is what is sent to the compiler

I'm not seeing the update firmware screen, could you describe what you did to get there.

olzeke51
Posts: 394
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: lpc812 ACMP routines

Post by olzeke51 »

from what I remember:
demo the code (no usb - making sure it would compile)
connected usb
run - same message display as in demo mode - ie no effect
exited ARMB
usb still plugged in (had a previous program in chip - HWPWM8.bas - led showed toggle on the 3 outputs)
started up ARMB (I think I did some <ESC>s to keep from running the PWM program)
got the welcome message
loaded ACOMP03.bas
got the popup [notice there is/are no status messages!! in the screendump]
*******************************
I tried to duplicate the scenario but no popup (reloade HWPWM8, etc ..)
FYI I did get the 'duplicate LPC812' message with HWPWM8 this time -
(can't remember if I got it the first time with HWPWM8)

***********************************************************************************
after reading some of the online manuals and seeing (paying attention!) your .bas programs
I will use CALL instead of SUB/ENDSUB except when I want a RETURN'ed value, then
I will use the FUNCTION style. I will also use "label:",
DO You have any other preferences in coding style ?? I'm using Notepad++ ver 6.6.x (not your 6.3.x)
tab spacing, CAPS usage, comments - areas and placement on a line of code

Gettin' up to speed !!!

olzeke51
Posts: 394
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: lpc812 ACMP routines

Post by olzeke51 »

this popped up again.
not sure what is loaded in 812 but most likely some form of this program - acomp03?.bas

fired up BT, no to usb ??s, plugged in my 812
quit BT
fired up BT, loaded this file and got the same popup

Is there some way to tell what program I have loaded??
a checksum location --No, unless there is a CLI [I don't have any debug installed in my prog]


[I did answer the popup but had nothing in the BT window
LIST at the CLI produce nada, same with !00000000
RUN at CLI produces "Exe" no quotes !! {what does that represent ??}

most likely a moot point - the program in 812 would most likely be slightly different htan what I uploaded
I use the working program and tweak or put in different variables to try things out
Attachments
ACMP03a.bas
firmware trigger maybe
(6.19 KiB) Downloaded 353 times

basicchip
Posts: 1038
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: lpc812 ACMP routines

Post by basicchip »

Exe is Executing... with your program crashing before all the characters are sent.

olzeke51
Posts: 394
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: lpc812 ACMP routines

Post by olzeke51 »

Wow, evaluating is challenging , so is learning

I now got the 'firmware popup' BUT it is a different error code !!!

was having trouble with ACMP03a. kept hanging going into a SUB (would usually only show 'exe' OR the <stop> button was red)
SO I started a fresh ACMP05 - no cut and paste or copy/duplicate file - just started typeing. was having difficulty getting a
value to the SUB - even though it was DIM'd before the main (and initialized). The screen background shows a successful run -
I had commented out the "pin = 2" just inside of Main: [but not what I was trying to accomplish]. So I added a "pin = 2" just
prior to Main: ; DID a CTRL-R from the CLI ; and POPUP happened- with a different error number in the title bar

side question - is there a checksum check on the flash contents against the file download?? I had been using the DEMO mode
to do these minor changes/test then would do a d/l -- trying to save wear & tear on the flash, but with 10,000+ writes available. . . ,
IT ALSO kept me from getting 'duplicate value in defining LPC812" or "multiple error guards in coridium_pcb messages"
I also assume you do 64 byte page padding for flashing
Attachments
ACMP05.BAS
(310 Bytes) Downloaded 318 times
acomp05_err32.GIF
acomp05_err32.GIF (18.28 KiB) Viewed 11767 times

basicchip
Posts: 1038
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: lpc812 ACMP routines

Post by basicchip »

You will get that popup when you connect to a device with firmware earlier than 7.15, which we no longer support without a firmware upgrade. I can't duplicate what you are seeing, and I fired up an old XP system. Can you describe exactly what key strokes, mouse clicks, whatever you do to get that? I also don't know what you mean by CLI

as for some code suggestions

acmpdata = *(CMP_CTRL)

CMP_CTRL is defined as #define CMP_CTRL *&H40024000 ' Comparator control register in LPC8xx.bas, so what your code really is --

acmpdata = *( *&H40024000)

which will read what is at &H40024000 and then read what is the location with whatever value that is. So most of the time this will crash the program. It should be.

acmpdata = CMP_CTRL

Programs begin as main: so any code before there will only declare variables, but NOT initialize them to other than 0, or be called as SUB or FUNCTION by main

pin = 2 ' this declares the global variable pin, but it does NOT assign 2 to it, as the code never gets executed

SUB use_pin
print pin
ENDSUB

pin = 2 ' again this does nothing

main:
pin = 2 ' now pin gets the value 2

olzeke51
Posts: 394
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: lpc812 ACMP routines

Post by olzeke51 »

Okay - get to type this all over again -I started to reply ; I had my dinner ; and by the time I added more and did a "submit" - it timed out and lost it all

re: firmware version - it came on the eval 812
my gif shows ARMBasic as (9.32c) and kernel as (8.32a) , BT was just downloaded from your future forum - teensy update

re: CLI command line interface - the skinny window at the bottom of BT where you type in commands or program lines

re: my usage of double pointers -- my bad ; but I don't see how reading would cause an error unless there is an INTVEC for a
non-assigned memory area - not an issue

re: variable assignments - the DIM and 'variables' help shows the assignments after the DIMs - but there is no indication of Main:
now MAIN does specify that the assignments must occur in Main: * * * * thanks for the confirmation -- this is what ACOMP05 was trying to verify !!!!!
BTW- a CONST (string) can be defined prior to Main:

re: POPUP ERROR - - - - I was able to duplicate it twice !!!
// these two times it came up with the original '007E' not the '032' that I just reported-- 4digits vice 3 digits ??????
scenario : USB/812 connected to cold computer, powered up computer, did some email, looked at this forum
fired up BT
<reset> [clicked on the RESET button in BT]
got printout [so the program was still in there]
file / load ACOMP05.bas
<reset>
printout
----routine starts vvv
CTRL-R ** file menu shows this as an alternate way to reload the file
************* [popup occurs here - before I do the <reset>
<reset> ** 8th time I did this routine it popup errored on me - with '007E'
printout **
******************** 2nd scenario
quit BT [from the file menu]
fired up BT
<reset>
got printout [so the program was still in there]
file / load ACOMP05.bas
<reset>
printout
CTRL-R **
** [popup occurs here - before I do the <reset>
<reset> ** 2nd time I did this routine it popup errored on me - with '007E'
printout **
---------------- this is the program printout --------------
0
1
this is now pin 1


... program done

***************************************hope this helps
two different errorno's
the quick 2nd scenario happened once before -- probably in acomp03 - that's why I started acomp05 from scratch

*************shortly after posting the above
I save a copy as acomp05 to acomp06 in notepad++, did some minor changes
AND * * * now CTRL-R from the CLI doesn't work most of the time - maybe one time out of 6 ??
so perhaps the hot key CTRL-R routine is mangling something - although there are no program errors reported before the <reset>

**************shortly after posting the shortly after posting the above
I've been running acomp06 (of coarse making changes) and when CTRL-R quits working I use the file menu/load file
BUT this time I have been using <RUN> button
AND have gotten two "007E" erros and one '032' ----[haven't kept track of my button clicks, etc ]

basicchip
Posts: 1038
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: lpc812 ACMP routines

Post by basicchip »

I can not duplicate what you are seeing, so can't tell you why other than the normal, do you have all the windows XP updates and yadda yadda

I have never seen ctl-R fail, and you don't need to ...

Just as I was typing this it did happen to me with the focus on the CLI as you call it. ctl-R works anytime BT is the active window
And now after doing it once it doesn't repeat, so I'm not really going to worry about it.

And yes reading register space that doesn't exist in an ARM usually causes a bus fault, so that will crash a program, sometimes we catch it in our default interrupt handler and sometimes we don't and it just goes into never never land.

If a program has a MAIN: it starts there, if not it starts on the first line of code. And CONST strings are not executed, but compile time actions, so they do occur in the order they are compiled.

basicchip
Posts: 1038
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: lpc812 ACMP routines

Post by basicchip »

After seeing once, I've never seen that again, so maybe it is some timing issue, and so far you are the only one to report it, so I'll have to leave at that for now.

Post Reply