PDA

View Full Version : Propeller OS



Mike Green
10-07-2006, 11:17 AM
Here's the latest version of the Propeller OS. In addition to some bug fixes, these are the major features added/changes:
1) All 3 display versions are included. There are 4 modules currently that are display dependent and the display dependent versions are in folders labelled with the type of display desired (TV, lowres VGA, hires VGA). The different types of modules have the same names (OS_initialization, OS_dspText, OS_dspTextInit, OS_loader). Just copy the set you need into the top level folder and compile.
2) The keyboard lights work again
3) There are early versions of support for GHI Electronics' uALFAT-SD and USBwiz. The USBwiz version is for SPI, but will be changed to I2C. The OS compiles with the uALFAT-SD support which uses the TEST command and just allows you to type commands to the uALFAT and see the resulting messages. Like the editor, the App key (to the left of Ins) is used to exit from the TEST command. Eventually these devices will be integrated into the PROBE, LIST, COPY and RUN commands. For those that are not familiar with them, these support MMC/SD cards with standard FAT directories (compatible with Windows, Mac, and Linux). The USBwiz also supports USB flash drives and a slightly different uALFAT-USB device supports USB flash drives instead of the MMC/SD cards, but with essentially the same command set.
4) The initialization routine has been moved to its own object. This simplfies the process of writing your own program using the OS routines without the command interpreter. You only have to reference the initialization object and call its start routine as the first thing in your main program.

Other plans:
1) Add cursor capability to the TV and lores VGA drivers and eventually make all three drivers strictly compatible except for display size and color capability. As much as possible, the color display control sequences will be made compatible. The intention is to make the three drivers interchangable
2) There is an experimental version of a LOAD command intended to allow direct downloading from the Propeller Tool using a USB2SER adapter (to avoid the reset from the Propeller Tool). It doesn't work yet and I'm not sure why. We'll see if I can get it to work eventually.

----------

The pre-Halloween update is attached. There's a ReadMe file and some more demo programs, some minor corrections and additions.

Post Edited (Mike Green) : 10/27/2006 11:09:51 PM GMT

nutson
10-07-2006, 04:14 PM
Mike, I cannot compile the OS, the prop IDE tells·me·I exceed the 32 object limit. After this·message the IDE crashes on exit. Commenting out·the EEprom loader and ALFAT objects is not enough,·also commenting out the Window·editor·results in succesfull compilation and run. Only I cannot enter commands of course. Can I adjust this 32 object limit, or do you have another version of the IDE?



Nico Hattink

Mike Green
10-07-2006, 10:40 PM
Nico,
I've got a newer version of the IDE. I don't remember if the fix for this has been posted yet. Do you have the 0.98.1 version?

If it's not been posted yet, I'll have to post the compiled binaries for now so people don't have to compile.
Mike

nutson
10-07-2006, 11:03 PM
I run the 0.98.1 version as posted on the Parallax site. Are you working under OS-X running some kind of Windows emulator? Maybe that makes the difference. Anybody else working under XP have the same problem? What a shame, I had a G5 standing in my study that I donated away some days ago....

Nico Hattink

Mike Green
10-07-2006, 11:22 PM
I use Virtual PC (or sometimes Guest PC). Both are PC emulators.

I ran across this 32 object limit before, trimmed back the number of objects. Parallax did fix the IDE, but I had forgotten that it hadn't been released yet. In trying to fix other stuff in the OS, I guess I've crept across the 32 object boundary again. Sorry.

I'll post the binaries this afternoon for each of the display types. You could try to embed the initialization routine back in the main program. That would eliminate one more object and might make it possible to compile. The editWindow object was put in a separate object because I expect it to get more complicated in the future. That could also be put back in the main program to eliminate another object.

Mike Green
10-08-2006, 02:43 AM
Here's the Propeller OS archive with the pre-compiled binaries in each of the folders (for the specific display). You can load the binary into the Propeller Tool with the Open menu item and it can be downloaded that way to a Propeller.

nutson
10-08-2006, 03:49 AM
Thanks Mike, I can work with the binaries. Good to support various display possibilities. I'll remain with version 1.031 for my own experiments till I hear about an IDE fix.

Nico Hattink

Newzed
10-09-2006, 05:05 AM
Mike, in the OS version I am using, the default display is yellow font on a blue background.· Is there any way to change the color of a line for emphasis, say cyan, green or white, then return to the default display?

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-09-2006, 06:48 AM
Sid,
In both the low resolution VGA version and the high resolution VGA version, there is an ability to affect the color of the display. In both cases, look at the list of control codes at the beginning of the display object (OS_vgaHiresText.spin or OS_vgaLoresText.spin). Most of these are the same in the different display versions, but the color ones are display dependent. The one you want is called "Color".

For the high resolution VGA display, do a series of "dsp.out" calls like "dsp.out(dsp#Color)", then "dsp.out(row)" where "row" is the display row to be affected, then "dsp.out(foreground)" where "foreground" is a foreground color, and "dsp.out(background)" where "background" is a background color. There's a comment describing "colorPtr" which gives the format for each color byte. Essentially it's %RRGGBB00 where RR is the two bits for red intensity, GG is the same for green, and BB is the same for blue. You'll have to experiment. I think the high resolution VGA text display demo program that Chip wrote displays samples of each text color combination.

For the low resolution VGA display, the color is set on a character by character basis with the same control code followed by a color number from 0 to 15 as in "dsp.out(dsp#Color)", then "dsp.out(color_code)". The default color codes are listed in a comment at the beginning of the OS_vgaLoresTextInit object and can be changed with a control code "SetColor". Again, this is based on Chip's video driver and the demo program for it does display text in different colors.

Newzed
10-09-2006, 10:09 PM
Mike, I studied the vga_hirestext and I came across this line in the COB block:

Color······ = $13········ ' change the colors of a row (Y, FG, BG follow)

I finally figured out that Y was row, FG was foreground color and BG was background color.· I won't bore you with the details but after a couple of hours I wrote:

· text.out($13)
· text.out(6)
· text.out(62)
· text.out(10)
· text.str(string("B - Red motor Off",13,13))

and it turned the text string bright blue with the same background as the default.· Then I wrote:

· text.str(string($13,6,62,10,"B - Red motor Off",13,13))·····

Same result - pefect.· Exactly what I wanted, but not where I wanted it.

So....I wrote in the DAT list:

op4Desc··· byte 13,"' -- ' is the decrement operator, either pre or post.· Let's say X := 10",13,13

byte $13,3,62,10,"Example of pre-decrement:· Y := --X + 2",13,13

byte "In this case X is decremented by 1 before the calculation is performed",13

byte "So...Y := --X + 2 = Y := 9 + 2 = 11.",13,13

byte "Example of post-decrement:· Y := X-- + 2.",13,13

byte "In this case, Y := 10 + 2 = 12, and then· X is decremented to 9",13

byte "In both cases X becomes 9 and retains that value until otherwise changed", 13, 13,0

and·the red·line changed to bright blue.· I tried to change color on the "post decrement" example but couldn't do it.· I could change it in combination with the previous line but never just by itself.· So finally I wrote:

op4Desc··· byte 13,"' -- ' is the decrement operator......···········
byte $13,3,62,10,"Example of pre-decrement:· Y := --X + 2",13,13
byte $13,5,62,10,"In this case X is decremented by 1 before .....······ byte $13,7,62,10,"So...Y := --X + 2 = Y := 9 + 2
byte $13,8,62,10,"Example of post-decrement:· Y := X-- + 2.",13,13
byte $13,10,62,10,"In this case, Y := 10 + 2 = 12, and then..........
byte $13,11,62,10,"In both cases X becomes 9 and retains........

and all lines changed to bright blue.· I then deleted the color change from all lines except the example lines.· Both example lines changed color, PLUS the line before the post-decrement example.· Don't understand it.

have a doctor's appointment.· Will post more when I return.

Sid
·····

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-09-2006, 10:28 PM
In my previous post, I mention some comments in OS_vgaHiresText. Here they are:



'' colorPtr = Pointer to 64 words which define the foreground and background
'' colors for each row. The lower byte of each word contains the
'' foreground RGB data for that row, while the upper byte
'' contains the background RGB data. The RGB data in each byte is
'' arranged as %RRGGBB00 (4 levels each).
''
'' color word example: %%0020_3300 = gold on blue






'' Control codes. For convenience, supplying a # cols and # rows of zero will use the maximum
'' allowable values (screen width - x, screen height - y). Because of the limitations on colors
'' (foreground and background for each row only), the Color command will set the colors for a
'' specific row. The colors do not scroll with the text.



The VGA driver has only limited color capability and a row of text can have only one color pair (foreground and background). The Color command changes the colors of a line when it (the command) is output, not when the actual text is output. I hope this helps.
Mike

Newzed
10-10-2006, 12:16 AM
To continue, Mike.

I read the portion you quoted above, but since I don't know what word calls
up what color, nor how to call the pointer, it didn't really help.· I can make
things work with the $13 command hopefully, but my question now is - in
the DAT block, if I put the command at Line 8, why does it change Line 7 also?
That part bugs me.

In $13, 8, 62,10 - 62 is the foreground color (bright blue) and 10 is the back-
ground color (dark blue)· 10 is just what I want for background, but do you
have a list of what numbers yield what colors for the foreground?· If not,
I can punch in all the numbers and jot down what color I get.

Had an idea - changed Line 7 to $13,6,12,10, and left Line 8 alone.· Now Line
7 changes to a different color and Line 8 changes to bright blue.· If I had the
color number for yellow (or whatever the default is) I'd have it made.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-10-2006, 12:25 AM
Sid,
The line number is zero-based as are all positioning commands and it doesn't matter what position the "cursor" is in when you do a "Color" command, the command contains the line number of the line to be affected. Do check out the hires VGA text demo that Chip wrote. I think it does demonstrate a variety of color combinations. I don't have a list of color codes.
Mike

Newzed
10-10-2006, 02:21 AM
Mike, type this little method into your OS program, call it, and see what
you get.· Fascinating!

PUB colorfile
··· text.out(0)
··· text.out(13)
··· text.str(string($13,1,62,10,"Color is 62",13,13))
··· text.str(string($13,3,180,10,"Color is 180",13,13))
··· text.str(string($13,5,200,10,"Color is 200",13,13))
··· text.str(string($13,7,230,10,"Color is 230",13,13))
··· text.str(string($13,9,240,10,"Color is 240",13,13))
··· text.str(string($13,11,254,10,"Color is 254",13,13))
··· text.str(string(13,13,$13,15,254,10,"Press any key to return to Menu",13))
··· key.getkey

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Newzed
10-10-2006, 05:15 AM
Mike, I augmented my colorfile method to include some background color changes.·
I noticed that when I returned to the Menu screen, the background color changes
carried over into the Menu screen.· In order to offset this, I had to add the
following at the end of the colorfile method:

key.getkey
··· text.str(string($13,19,240,10))
··· text.str(string($13,21,240,10))
··· text.str(string($13,23,240,10))
··· text.str(string($13,25,240,10))
··· text.str(string($13,27,240,10))
··· text.str(string($13,29,240,10))
··· start2

This forced the offending lines back to the default colors, but I was wondering -
is there a command I could enter just before the ShowMenu method that would
reset all the rows back to the default color, thus negating the previous color
changes.· I tried returning to "initialize" instead of "start2" but that did not solve
the problem.· I can reset and everything goes back to normal but that is not an
option I want to use.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-10-2006, 05:23 AM
The color table changes are permanent until otherwise changed or the video driver is stopped and restarted. By using text.out, you can set up a loop which would be easier, like this would set all lines to a foreground color of 240 and background color of 10:



repeat i from 0 to 39
text.out4($13,i,240,10)

Newzed
10-10-2006, 05:35 AM
Mike, I had to change i to z because i is used by another method, but it works great.· Thank you.· What is the significance of the "4" following text.out?

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-10-2006, 05:40 AM
FOr convenience, there is a set of multiple parameter calls to xxx.out() in the display object. out2(x,y) is defined as out(x), then out(y). Similarly, there's an out3 and out4. They're useful instead of using string() when one of the parameters is not a constant.

Newzed
10-16-2006, 09:42 PM
Mike, I downloaded your revised OS system, extracted everything to a special
folder, and renamed the keyboard and keyboardinit files to keyboardA and
keyboardinitA.· Put them in the OBJ block of my current program and now
all the keyboard lights work great.

Tried to run your simple Demo but no display - looks like the VGA is never started.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Newzed
10-19-2006, 09:03 PM
Mike, some of the options in my program produce data on the screen.· Is
there any way I can simultaneously display this data on Hyperterminal
where it can be saved to an Excel file - perhaps use the existing "serialout"
method and change the pin to 31?

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-19-2006, 09:42 PM
Sid,
You could use the existing serialout method. The biggest problem with using the existing serial/USB connection is that, on most boards, DTR transitions always causes a reset and, when Windows or the Mac OS open that serial port, they fiddle with DTR. If you can temporarily disconnect the reset line, then you could usefully use pin 31, otherwise use some other pin with a USB2SER or PropPlug adapter.
Mike

Newzed
10-20-2006, 02:46 AM
Mike, I sent the data to the Stamp and had Stamp send it to Hyperterminal.·
Sneaky, eh what?

Sid



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-20-2006, 04:12 AM
That's a great idea. The Stamp is already RS232 tolerant on the debugging port (16) and, as long as it has enough memory to do the job, is very good at simple serial I/O.

Mike

Loopy Byteloose
10-21-2006, 01:04 AM
I just ordered one of Terry Hitt's SDcard reader/writers and am wanting to use it with the Propeller. It uses an RS-232 interface at 19200 baud and has a 32K SRAM buffer.

Does anyone have any idea if this will easily fit into your Propeller OS scheme?


Also, I am curious if you ever resolved the lack of a cursor in the opening posting.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"If you want more fiber, eat the package.· Not enough?· Eat the manual."········


···················· Tropical regards,····· G. Herzog [·黃鶴 ]·in Taiwan

Mike Green
10-21-2006, 02:09 AM
Kramer,
I'm trying to integrate another SD reader/writer (the GHI one), but the same code would apply with Terry's except that you can't delete or rewrite a file as far as I can tell. Ask me again in a couple of weeks.
Mike

Newzed
10-21-2006, 06:15 AM
Mike, do you by any chance have a graphics display program for OS?·
Something like the Graphics_Demo for TV.

Sid



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Newzed
10-21-2006, 11:16 PM
Mike, I wrote the following:

·text.str(string($02,j,21,"*",13))
· text.str(string($02,j,22,"*",13))
· text.str(string($02,j,23,"*",13))
· text.str(string($02,j,24,"*",13))
· text.str(string($02,j,25,"*",13))·

j = X = a constant 10.· This prints 5 vertical " * " starting at X = 10, Y = 21.
Is there a way to increment Y a given number of times without having to
write a separate line for each Y position?· I wrote 21++ and
that didn't work.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Graham Stabler
10-21-2006, 11:44 PM
repeat y from 21 to 25
text.str(string($02,j,y,"*",13))




?

Newzed
10-22-2006, 12:15 AM
Graham, that won't work.· In the MoveXY command:

$02,X,Y

X and Y are both constants or a unary value.· It I stick a variable in place of X or Y it won't compile.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Graham Stabler
10-22-2006, 01:38 AM
repeat y from 21 to 25
text.out($0A) 'see tv_text out command
text.out(x)
text.out($0B)
text.out(y)
text.str(string("*",13))




That allows any x,y you like. I'd make a function if I were you set_xy

Newzed
10-22-2006, 02:10 AM
What is $0A and $0B?

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Graham Stabler
10-22-2006, 03:45 AM
" 'see tv_text out command "

I guess that's just the way they designed it. There is no mention of $02 in the out command docs.

Phil Pilgrim (PhiPi)
10-22-2006, 04:04 AM
Guys,

I think Mike may be using my TV_wtext object instead of TV_text. If so, here is the list of control characters it recognizes:




CLS = $00 'clear screen
HOME = $01 'home
CRSRXY = $02 'set X, Y position (X, Y follow)
CRSRLF = $03 'cursor left
CRSRRT = $04 'cursor right
CRSRUP = $05 'cursor up
CRSRDN = $06 'cursor dn
USECLR = $07 'use color C (C follows)
BS = $08 'backspace
TAB = $09 'tab (8 spaces per)
LF = $0A 'linefeed
CLREOL = $0B 'clear to end of line
CLRDN = $0C 'clear down (to end of window)
CR = $0D 'return
CRSRX = $0E 'set X position (X follows)
CRSRY = $0F 'set Y position (Y follows)
DEFWIN = $10 'define window W (W, Left, Top, nCols, nRows follow)
USEWIN = $11 'use window W (W follows)
DEFCLR = $12 'define color C (C, FG, BG follow)
SCRLLF = $13 'scroll window left
SCRLRT = $14 'scroll window right
SCRLUP = $15 'scroll window up
SCRLDN = $16 'scroll window down
CHGCLR = $17 'change all colors in window to C (C follows)
CLRW = $1E 'same as CLR, but can be used in strings.
ESC = $1F 'escape next character C (i.e. print as-is) (C follows)
ZERO = $FF 'can be used for 0, which is not allowed in strings, for command arguments




Except for the windowing and color stuff, these are much the same as the PBasic DEBUG screen commands. You can copy these definitions into a CON block and use the names in your code instead of the numbers to help readability.

Sid,

One of the items on top of my Spin wish list is an inline constructor for strings, along with byte, word, and long arrays, that allows variables and expressions. It would be very handy also for creating parameter lists where the number of parameters can vary. Hopefully, someday...

-Phil

Graham Stabler
10-22-2006, 06:33 AM
So in that case I assume he could do:




repeat y from 21 to 25
text.out($02)
text.out(x)
text.out(y)
text.str(string("*",13))




??

Graham

Newzed
10-23-2006, 07:07 AM
Mike, I wanted to add another option to my PropWorks program.· I added the
simulator object, the senddata method and the recdata method.

PUB SendData(c)
·· serialOut(0,c,stampBaud,sim#NInv,8)

PUB recData | c
··· text.str(string(13,13,"· Received:· "))
··· repeat until (c := serialIn(1,stampBaud,sim#NInv,8)) == 10
····· text.out(c)
··· text.out(13)
··· waitcnt(wait + cnt)

When I tried to compile, I got an error "Expected an instruction or variable"
and it highlighted the "serialOut" word.· Can you think of any reason why?
It is exactly like my other Prop program, which works great.

Sid





▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

AIman
10-25-2006, 03:48 AM
I'm lost.

What do I need to do to get the OS to run?

Do I need a blank memory or simply a place to store it?

Do I need a computer or something else?

What is the newest version?

Mike Green
10-25-2006, 06:05 AM
1) You need at a minimum a Propeller Demo Board or the equivalent with a PS/2 keyboard connection and either a TV video connection or a VGA connection. By equivalent, I mean "wired the same as the Demo Board".

2) The OS runs out of the standard 32K boot EEPROM as supplied on the Demo Board, PropStick, or equivalent. It works better and you can do more if you have more memory, either additional 32K EEPROMs or larger I2C EEPROMs attached in place of the standard boot EEPROM or in addition to the boot EEPROM on the same I2C bus (pins 28/29) or as an additional I2C bus on any pair of I/O pins.

3) You need a PC running Windows XP and the Propeller Tool to compile and download programs including the OS. A Mac will work if you have an Intel Mac with BootCamp or a Power PC Mac running Guest PC or Virtual PC.

4) Look at this thread <http://forums.parallax.com/forums/default.aspx?f=25&m=147980&p=1> for the current version.

5) The OS is not what most people think of these days as an operating system. It's basically some I/O routines (keyboard, display, and I2C) and a program loader along with a simple command interpreter. It has a framework for more, like the beginnings of a simple text editor and a very simple file system using EEPROMs.

Newzed
10-25-2006, 09:58 PM
Mike, I wanted to see if I could send a string from the Prop to the Stamp.·
I added two new methods:

PUB sendstr(str)
··· serialStr(0, str, stampBaud,sim#NInv,8 )
···········
PUB serialStr(pin, str, Baud, mode, bits ) | c·········
· repeat while (c := byte[str++]) <> 0
····· serialOut(pin,c,Baud,mode,bits)

Then I called sendstr with:

sendstr("Hello",0)

I got an error saying a ) was expected after the H - what did I not do?

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-25-2006, 10:15 PM
Sid,
Remember, you have to use the "string()" built-in function like "sendstr(string("Hello",0))".
Mike

Newzed
10-25-2006, 10:29 PM
The compiler won't accept " 0 " in a string.· How do I get the terminating
" 0 " in?

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Newzed
10-25-2006, 10:31 PM
Would I write:

sendstr(string("Hello, 0")

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-25-2006, 10:54 PM
Sid,
Please look at the example I just posted previously. Maybe the double quotes I put around the whole phrase confused you. Here it is as a code fragment:



sendstr(string("Hello",0))

Newzed
10-25-2006, 11:03 PM
OK, Mike - I've got the Stamp receiving a string.· I wrote:

sendstr(string("Hello *,0"))

The " * " terminates the Stamp string if it is less than the declared bytes.·
Now then another question - the Hello is written into the program for a start.
In real life I would like to press the option key, have the screen say:

"Enter string to transmit"· and then be able to enter a string, save it to a
variable, then be able to write sendstr(string(variable)).

How do I do that?

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-25-2006, 11:47 PM
Why don't you try to come up with something to do this? You have to accumulate a sequence of bytes in a byte array from the serial input routine, check for some kind of terminating character like a return (13). You have to store a zero at the end of the string (when the return comes in). You have to check for too many characters. When that's all done, you have a zero-terminated string in a byte array. You can pass the address of the byte array to sendstr (or any other routine that expects the address of a string).

Newzed
10-26-2006, 01:12 AM
You are asking a lot, Mr. Green.· I can send a string from a DAT list, so now
I'll·try the on-the-fly thing.· If you don't hear from me in 24 hours call 911.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Newzed
10-26-2006, 03:22 AM
Mike, I declared a VAR "msg[16]" - 16 being the number of bytes in the Stamp
serstring, and wrote the following new method:

PUB writestr | p
··· text.out(0)
··· p := 0
··· text.str(string("Enter string to send",13,13))
··· repeat until· (msg[p] := key.getkey) == 13
····· text.out(msg[p++])
··· sendstr(@msg)

At the prompt I typed in··"Does it work?*0" (without the quotes) and the
Stamp· debug displayed··"Does it work?".· It would have been nice is the
Stamp had said· "Of course!"· but I guess it's not that smart.

I never thought I could do it.· I think I shall promote myself again.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Graham Stabler
10-26-2006, 03:27 AM
Confidence is knowing its worth having a go, be confident!

Graham

Newzed
10-26-2006, 03:34 AM
Thank you, Graham!

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-26-2006, 06:44 AM
Excellent!

Now how would you add:
1) The zero byte at the end. (It worked the first time. Try calling writestr a second time and entering just "Hello?")
2) Checking for too many characters (Hint: Treat the 16th character as if it were a return)

Newzed
10-26-2006, 07:15 AM
Mike, I found out that if I enter:

Hello* - without the 0 - it works just as well, probably because when p
increments and I press Enter, it reads a 0 - I'm not sure.· However, I can not
leave off the *.· Without that the Stamp keeps waiting for another byte
unless the Prop sends 16 bytes.

On the too many characters thing, I didn't worry too much about that.· The
Stamp is going to limit any reception to 16 bytes.

I'm working on the Stamp writing to EEPROM whatever it receives from the
Prop.· If I get that worked out, I can switch to a BS2pe and use the last 8
banks - 16KB - for inventory data.· That would save a lot of memory in the
Prop.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-26-2006, 07:25 AM
1) The problem with leaving off the zero isn't on the Stamp end. It's on the Propeller end. The serialStr routine keeps sending characters until it finds a zero. If, for some reason, there isn't a zero byte for several thousand bytes beyond the end of the entered string, the Propeller will keep sending what it finds until it stumbles across a zero.

2) Again, I'm not worried about the Stamp end. On the Propeller end, you will eventually start storing characters into the next declared variable (or maybe into a section of SPIN interpretive code).

These boundary conditions are important. They often "bite" you when you least expect it and are difficult to find.

Newzed
10-26-2006, 07:50 AM
Mike, msg is declared as a 16-byte array.· Isn't that going to limit what
you can write to it?

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-26-2006, 09:32 AM
Sid,
No. What you describe is implemented in some programming languages, but not in C or SPIN for example. The declaration simply defines how much memory is set aside. Your program will continue merrily storing typed characters in successive locations in memory until something critical gets overwritten (or your fingers tire and you quit typing).
Mike

Mike Green
10-28-2006, 07:14 AM
The archive at the beginning of this thread has been updated. No big changes, mostly more demo programs and some documentation.
Mike

Newzed
10-29-2006, 03:41 AM
For Chip Gracey and Mike Green:

I wanted to add some math functions to my workhorse Prop program, so I
started writing the necessary methods, checking the program after each
addition.· And then........the program started acting weirdly, jumping to
methods that hadn't even been called.· I spent hours redoing and checking,
then I remembered something Mike had said about "popping" off the stack.
I really didn't understand what Mike was saying, but I had the feeling that
something was running into something.· So I saved the program as a new
version, deleted everything that was not fundamental to what I wanted to
do, and lo and behold, everything worked perfectly.

I still had about 2800 longs free when I was having the problem so it could
not have been lack of memory.· That leaves the stack - whatever that is -
as the source of the trouble.

The point of this is - is there some way the Propeller Tool could be modified
to alert the user when he is about to have a stack problem?· Had it not been
for Mike's comment, I would never have figured out what was wrong.· Maybe
the stack is not the problem, but no other possibility comes to mind.

Thanks, gentlemen.

Sid



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
10-29-2006, 06:14 AM
Sid,
You may also recall some comments of mine about recursion. In some of your programs, you are using the procedure call as a form of goto and that does cause exactly what you're observing. You're basically calling a routine that never returns and that routine calls another that never returns, etc. Eventually, some routine calls the first routine and the stack just keeps getting filled higher and higher with return addresses.

The Propeller Tool unfortunately can't tell you for sure whether you're going to have stack problems. It takes a lot of analysis on the part of the compiler to even make a good guess and that takes a huge development effort which Parallax is not set up for.
Mike

Newzed
11-08-2006, 12:04 AM
Mike, I'm back to this EEPROM thing again.· If I load the mill program into
the Demo board, it saves the X and Y positions just fine.· If I load the same
program into my Propeller board, it will not save them.· As far as I can tell
my Propeller board is exactly like the Demo board with the following
exceptions:

VGA start pin is 8 instead of 16
Only one PS/2 connector
No headphones or mike connections
The Demo board is programmed via a USB MiniB cable whereas my Propeller
··· board is programmed via a Prop Plug.

The pullup I had on SCL has been removed.· After programming the Propeller,
I removed the Prop Plug just in case.· Can you think of any reason the
Propeller board will not save X and Y?· I can give you the Expresspcb layout
of the board if that would be any help.· This is driving me bananas.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
11-08-2006, 01:53 AM
Sid,
It's driving me crazy too. I've corrected a variety of bugs in the OS and added some features in the last couple of weeks, but I'm holding off on posting anything until I can find and fix this intermittant problem with I2C I/O. It doesn't seem to show up on my main test rig (Demo Board with an additional Microchip 64K x 8 EEPROM on pins 0/1), but shows up on my new test rig with one or two 128K x 8 Atmel boot EEPROMs substituted for the standard 32K x 8 one. The Demo Board works fine with 400KHz I2C bus timing, but the new setup will only work at 100KHz and not 100% then. It's puzzling.
Mike

Newzed
11-08-2006, 02:03 AM
Mike, the Demo board uses an LQFP.· My Propeller board uses a 40-pin DIP.· Could that affect the timing?

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
11-08-2006, 02:20 AM
Sid,
There would be slightly longer paths from the chip to the board and probably from the DIP socket to the EEPROM, but it shouldn't make that much difference. The EEPROMs are not super high speed chips. The fastest clocks I use are 400KHz and the signals back and forth to the EEPROMs should be stable well under the minimum 250ns setup/hold times at the 400KHz clock rate. The video happens to be set up on pins 24-27 and there might be coupling to the adjacent pins, but I don't have an analog scope to check. I would expect more frequent problems and more random ones if that were the problem and that's not the case.
Mike

Newzed
11-10-2006, 04:45 AM
Mike, I have been trying to figure out a way for the Prop to display the time automtically every two minutes if there is no Menu selection.· So far no luck.· Here is the method where menu selection is made:

PRI getChoice : selectedOption
{ Accept menu choice. Returns uppercase letter. }
· 'key.clearkeys
· repeat
··· repeat until selectedOption := key.key
····· text.str(string(19,34,10,240))
····· waitcnt(clkfreq/2 + cnt)
···· text.str(string(19,34,254,200))·
····· waitcnt(clkfreq/2+ cnt)
··· if (selectedOption => "a") and (selectedOption =< "z")························
····· selectedOption -= 32··· '32 = ("a" - "A")··'Convert letters to uppercase
· until (lookdown (selectedOption : "ABCDEFOQGMNTPRS"))

I was trying to figure out a way to say "If no key is pressed within
waitcnt(clkfreq*120 + cnt) selection := "G".· Any suggestions?

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Newzed
11-10-2006, 05:09 AM
Chip, I went to the forum but your post wasn't there, even though I got e-mail notification.· Did you delete it?· Anyway, thanks for the heads up - didn't actually multiply the numbers out to see how big they were.· Doing four 30-second waits shouldn't be a problem if I can ever figure out how to do it without a key press.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

cgracey
11-10-2006, 06:08 AM
Newzed said...

Chip, I went to the forum but your post wasn't there, even though I got e-mail notification.· Did you delete it?· Anyway, thanks for the heads up - didn't actually multiply the numbers out to see how big they were.· Doing four 30-second waits shouldn't be a problem if I can ever figure out how to do it without a key press.

Sid



Sid,

I responded, but then realized I hadn't read your question carefully enough, so I deleted it.

Generally speaking, you need a loop that continues to execute, regardless of whether or not a keypress comes in. The keyboard object has a method which always returns, but gives (I think) -1 if no key was pressed. Anway, you need to wrap a loop around that while checking for lapsed time (perhaps by having milestone targets for every coming 30 seconds). I hope this helps, somewhat.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


Chip Gracey
Parallax, Inc.

william chan
11-10-2006, 11:14 AM
What is the main purpose of this Propeller OS?
To work like a PC?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my

Mike Green
11-10-2006, 12:20 PM
The Propeller OS is intended to provide a framework for creating complex programs for the Propeller. It supplies a standard text display driver and a keyboard driver. It provides a driver for EEPROMs (and other I2C devices) including a loader for programs and fast read/write routines. The I/O drivers are designed to run continuously as successive programs load and execute so that: 1) There's continuity so there's no practical difference between related programs and overlays. 2) Programs don't need the memory overhead of the I/O drivers. Once they're initialized and loaded into their cogs, the HUB memory occupied by their assembly code is not needed.

On top of this is a simple command interpreter to allow storage of multiple named programs on attached EEPROMs. There is the beginnings of a text editor and some utility functions. At some point, support for some USB and/or SD/MMC card mass storage will be added.

The idea eventually will be to make the Propeller somewhat self-supporting with at least a native assembler, possibly with a native SPIN compiler. There already exist two simple Basic interpreters for the Propeller that have no provisions for loading/saving of programs, but this could be added. There's a Forth system under construction that could be integrated as well.

In many ways, this is more like the early DOS or pre-PC small computer OS than what most people associate with the name today.

Bill Henning
11-10-2006, 05:00 PM
Mike,

Check out my large memory model for propellers... you might find it useful :)

Bill

Newzed
11-13-2006, 12:36 AM
I deleted my prevoous post because I didn't asl all the questions.

I need to input a value like $02 from the keyboard, and then set "day" - or hour, date, etc. - equal to this value.· How would I write this?· · I want to be able to reset my DS1302 on the fly.

Thanks

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
11-13-2006, 01:02 AM
Sid,
Look at the OS_mainProgram.spin file in the OS, particularly the method "getNumber" near the end. This will pick up characters from the screen buffer on the current line and process them as numbers, including decimal, hex ($), and binary (%). You can just cut and paste this routine (and the following "hexDigit" method) into your program then call it. You'll need the method "skipBlanks" too. For picking up words from the displayed information, use the method "getTextWord". The "enterDoCommand" method is the command scanner for the OS and contains all kinds of examples of different format commands and how they're scanned.
Mike

Newzed
11-13-2006, 01:22 AM
Mike, I'll try to decipher all that.· I know you're very busy so I won't ask for help.· If I can't make it work, I can always unplug the DS1302 and take it over to my Stamp to reset it.·

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Newzed
11-13-2006, 02:22 AM
Mike, would I use day, hrs, etc., for the numberAddr?· If so, then I would have to call this method 7 times, each time with a different numberAddr.· What would the normal value of x be?· ·0?

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
11-13-2006, 03:22 AM
Sid,
Basically yes to both. numberAddr points to a long where the binary value is placed. You would call this method 7 times, each time with a different numberAddr (to place the number). The value of x passed on the first call would be 0 if you wanted to begin scanning at the first column of the current row of the display. If you want to start at some other column, use that as the value of x. The routine always returns a new value of x if it's successful and that is normally used on the next call. Again, look at the command scanner. It usually uses "x := \getNumber(x,@value)". Error conditions always abort with a negative number and column numbers are never negative, so check for x < 0 after the call. Remember that the scanner sees what you see on the display because it's reading out of the display buffer.
Mike

Newzed
11-13-2006, 11:34 PM
Mike, I said·I wasn't going to ask for help but I am really stuck.· If you don't have time to mess with it, I'll wait until you do.

Got the clock program reading the time fine in OS.· Then I added a menu option to set the time:

·"C":
······· text.out(0)
········text.str(string("Enter day"))
······· getnumber(0,day)
······· settime

I added the GetNumber, skipBlanks and hexDigit methods, changing dsp. to text. and substituting u for x in the skipBlanks method and in all references in the other methods.

When I select Set time from the menu, the program jumps to getNumber.· I entered "$02" from the keyboard but nothing displayed on my screen and I could not get out of the "Enter day" line.· Do I need to add the WindowEditor object to the program?· The program compiled fine without it.· I think this is the line I'm having trouble with:

c := text.windowChar(u++,0)·

Whenever you have time.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
11-14-2006, 12:05 AM
Sid,
1) The second parameter to getNumber is an address. You need to put @day there instead of just day.

2) getNumber doesn't read from the keyboard. It just looks at the screen buffer. You need to write a routine that reads from the keyboard, displays on the screen, and stops at an Enter key code (or whatever you want). The WindowEditor object will do that for you and handles things like backspaces. You can look at the beginning of the "enterDoCommand" routine to see how the WindowEditor is called. If you want, you could modify getNumber and skipBlanks to read directly from the keyboard, substituting calls to key.getkey and dsp.out where there's a call to dsp.windowChar. You'd have to add some kind of handling for the Enter key and a backspace key if you wanted it. I think using the WindowEditor is better.

3) getNumber uses the abort statement on errors. If you don't use the "\" prefix to catch the abort, your program will just stop when an error occurs (like illegal character or end of line when it's not expected). Look at the examples of its use.
Mike

Newzed
11-16-2006, 05:19 AM
Mike, I just couldn't get the Prop to reset the DS1302 so I went back to the Stamp.· This time I used a BS2pe with a DS1302 piggyback.· When I ask· Stamp A·for the time the VGA displays:

The current time is 15:52:51 - Eastern Standard Time
Today is November 16, 2006

I added two more options to my Menu:

M - Send data to Stamp A·for storage
R - Read Stamp A EEPROM

I get the temperature from Stamp B, then send the data to Stamp A, where it is stored in bank 8.· If some time later I key in "R", Stamp A responds and the VGA displays:

Temperature was 79.6 at 15:35:36 on 11/16/2006
Temperature was·78.9 at 15:36:01 on 11/16/2006
Temperature was·78.5 at 15:47:22 on 11/16/2006

I can store 227 such entries in bank 8 and roll over to Bank 9 if I want to continue storing.· This leaves 6 banks to store·other data.

If I want to start over, I have an option at the beginning of the Stamp A program that lets me write 0's to all 2048 bytes of bank 8.

When the Stamp writes a data batch to EEPROM, it increments the EEPROM address and·WRITEs that address to the EEPROM in bank 0.· When the Stamp writes the next batch of data, it READs the EEPROM and gets the next address, so it knows where to write to.

Pretty neat, huh?

Sid









▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Newzed
01-16-2007, 08:08 AM
Mike, I modified my Propeller program and the program for the Stamp that stores the temperature data in EEPROM.· A picture of what the VGA display looks like now is attached.

When the temperature data is received from the data-collecting Stamp, the data to be stored in EEPROM is entered manually for each location.· The next step is to modify both Stamp programs so that when the data Stamp sends its info the the Propeller, it also sends it to the EEPROM Stamp for storage.· Not sure how I'm going to do it yet -· and don"t say "That sounds easy enough" - nothing is easy for me where the Propeller is concerned.http://forums.parallax.com/images/smilies/eyes.gif

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)

Newzed
01-17-2007, 04:23 AM
Mike, finally got all the programs modified.· Wound up with Stamp B sending the normal transmission to the Propeller, then transmitting an "M" to put Stamp A in the 'datastore' mode, followed by "I(nside), temp data, O(utside).temp data, S(hop), temp data".· Works perfectly.· I was even able to format the VGA display so that each group of three - Inside, Outside and Shop - is followed by a blank line.· Makes the whole thing very readable.· Here is what the display looks like:

96···· Inside···· 77.7··· 11:39:50··· 01/16
104·· Outside·· 83.4··· 11:39:50··· 01/16
112·· Shop····· 69.2· ·· 11:39:50··· 01/16

120·· Inside·····78.0··· 12:29:56··· 01/16
128·· Outside···77.8··· 12:29:56··· 01/16
136·· Shop····· ·72.1··· 12:29:56··· 01/16

and so on.

Sid



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Mike Green
01-17-2007, 05:15 AM
Sid,
You're really doing a nice job of splitting multiple functions among different processors and communicating back and forth. Sometimes with the ability of the Propeller to run several tasks at once, we forget that some tasks can be easily off-loaded to something like a Stamp or another Propeller.
Mike

Newzed
01-17-2007, 06:10 AM
Thanks, Mike

I've learned a lot about talking betweem the Propeller and a Stamp.· I'm actually using four Stamps now.· Stamp A, a BS2pe, is my clock
(DS1302 PB)·and EEPROM storage Stamp.· Stamp B, a BS2,·is my data collection Stamp.· Stamp C, a BS2,·receives temp data from Stamp D, a BS2, which is located out in the shop.· The Prop, Stamp A and Stamp B all have XBEE transceivers.· Stamp C receives data from Stamp D via a Parallax 433mHz transmitter/receiver, which I happened to have on hand, ·and relays the data to Stamp B via hardwired connections.

It has taken quite awhile to get everything working reliably and to give me the VGA display I wanted.· I could never have done it without your OS system and that outstanding "simulation" object.· That was the key to the whole thing.

I'm thinking of adding a wind direction and velocity module to Stamp B to complete my 'weather station', but·I need to check on the format of the wind module output.· The module is from fascinatingelectronics.com.

I'll keep you posted.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

TyreBiter
01-19-2007, 12:34 AM
Sid,

where can I find the source for your "simulation" object?

Regards
David

Newzed
01-19-2007, 12:53 AM
David, PM me with your e-mail address and I'll send you a copy.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?

Newzed@aol.com (mailto:Module?Newzed@aol.com)
·

Newzed
04-10-2007, 04:06 AM
Mike, I decided I would try my hand at machining a block, so I revised my Mill program.· The revision included the addition of two methods for moving the cutter up and down 50 mils, so I could call it from a DAT list.· Everything works fine, but in the revision process I noticed somewthing weird.· In the top half of the program where direction and travel·are entered from the keyboard, the pulsetrain =

"pulsetrain := (dist * Xppm)/100 ".

In the Autorun section pulsetrain =

"pulsetrain := (dist * Xppm)/50"

Both sections use the same pulsepin method, and a travel of 1000 is exactly the same, whether entered manually or via Autorun.· I have looked at the program a dozen times and I can not figure out why the two different statements produce the same result.· Can you tell me?· I have attached a copy of the original Mill program, without the revisions ,·in case you need to refresh your memory.

Whenever you have the time.

Thanks

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.

That is why they call it the present.

Don't have VGA?
Newzed@aol.com (mailto:Module?Newzed@aol.com)

Mike Green
04-10-2007, 04:21 AM
Sid,
You'll have to figure this one out for yourself. Your program is too complex and not well enough documented for its complexity for me to sort out. Clearly there are maybe 6-8 places where you have "/100" and 2-3 places where you have "/50". I suggest you figure out what set of control inputs you would need to force the program through one set of computations (with "/100") and which ones to force it though the path with the "/50", then compare the outputs. You might be able to figure out why it seems to work ok. It may be that the program isn't going through the paths you think and, fortuitously, it's actually doing the "right thing".

The trick in debugging this sort of thing is to really simplify what you're trying to debug. You program is doing all sorts of things that, hopefully, don't affect this particular computation (for pulsetrain). If you can pare the logic down to a simple flow chart that just involves pulsetrain and inputs and decisions that affect pulsetrain, you can often figure out what's really happening (and fix it). Good luck.