Subject: PIC vs. PICAXE
From: Rotary Engine
Date: 3/2/2007, 8:54 AM
To: AARotary Engine



Well, I was mistaken. PIC only offers assembler and C. There are other
tools available, but not directly available from them.

Unless things get very complicated you are better off with the PICAXE IMHO.

Doc Custer
Retired Software Engineer and sometime Audiologist

I agree Doc. I am a bit disappointed in the lack of in line
assembler code. PICAXE brush it off as bad programming.

Do you know how to convert a 4 character ASCII decimal number
into a 16 bit binary number in PICAXE BASIC?

I can do it in ASM by masking the high 4 bits, shifting left
the lower four bits and anding the digits.

This is for the heading auto pilot that gets in heading info
from the GPS in ASCII characters. 189.1 degrees for an example.
Here is the ASCII binary codes. I need a binary number to control
the aileron servo.

Dec      Binary         Hex    ASCII
48 00110000 30h 0
49 00110001 31h 1
50 00110010 32h 2
51 00110011 33h 3
52 00110100 34h 4
53 00110101 35h 5
54 00110110 36h 6
55 00110111 37h 7
56 00111000 38h 8
57 00111001 39h 9

BTW the PICAXE would make a great waste gate or boost controller for
all those turbo guys out there. An intake air temp sensor as well
as the MAP sensor could be used to back off on the boost when
the intake  air temp. gets over 140 degrees F to prevent detonation.

Well, I could make a smart remark like it is real easy to do in C, but I
won't. :)

First isolate a digit (make sure it is a digit) into a single byte, then
subtract ASCII '0' = 48.

Right shift can be done by dividing by the appropriate power of 2. For
example, shift right 4 bits: x = y/16. Since negative numbers are not
supported, sign extension is not a problem.

Left shift is the same only the operator is multiplication, not division.

AND can be used to mask. There is an exhaustive set of bitwise operators.
See p. 51

BTW, there is an error on p. 28 of the basic manual.

PICAXE provides an assembler, but I could find no reference to a linker. So
it seems that the code must be all BASIC or all assembler. And the assembler
code would appear to have to be monolithic, all to be assembled at one time.

Hope this helps.

Doc Custer
Retired Software Engineer and sometime Audiologist


Thanks Doc.
-- 
Paul Lamar ...No rotor no motor.

The Rotary Engine NewsLetter. Powered by Linux.
ACRE NL web site. http://www.rotaryeng.net
Copyright 1998-2006 All world wide rights reserved.