Mill OS modifications
Mike Green
Posts: 23,101
Here is the changed Mill OS. I changed ReadByte and WriteByte to use the routines in OS_loader and modified changeXpos and changeYpos to keep the values in the high end of EEPROM memory in case you want to just load from RAM. I also added two calls to ReadLong in your start routine to read the values from the high end of EEPROM. Give this a try.
Comments
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
I'll have to look again at the I2C code. It does check specifically for the boot EEPROM pins and assumes that there's no pullup on SCL. It should work whether there's a pullup or not (if you assume there's none, it should work if there is one). I'll let you know.
Mike
· xpos := ReadLong($7FE8)
· ypos := ReadLong($7FEC)
I added a line:
WriteLong($7FE8,50)
When I booted up, the VGA said X = 0.· Does that tell you anything?
Sid
·
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
So......this program will work ONLY if the is no pullup on SCL.· That is fine with me.· The only place I need to save the posits is when I running the mill - I don't need to save them when I am dry-running a new etch program in here.· My mill program is now as perfect as I could ask for.· V1.20 will now be the running version - I'll delete V1.10.
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
I've got a busy couple of days and will probably not get to it until Sunday evening. I'm working a couple of evenings (at my real job) and have all-day workshops through Sunday. Hopefully I'll have the whole day Monday to work on it too.
Mike
waitcnt(cycle + cnt)
and I am trying to correlate it with the statement:
waitcnt(clkfreq + cnt) where clkfreq = 80,000,000 which equals one second.
It would appear that if 80,000,00 = 1 second then 600/80000000 would equal .0000075 = 7.5us.
Can you straighten me out?
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
If you want "cycle" to be in microseconds, you have to write WAITCNT(cycle * (clkfreq / 1_000_000) * cycle + cnt)". This will take the current clock frequency (stored at location zero in HUB RAM by the SPIN compiler or by a CLKSET call) and compute the number of clock ticks per microsecond, add it to "cycle", then add "cnt" and wait until then.
If you noticed, I changed calls to PAUSE(x) to be WAITCNT(x*clkfreq/1000 + cnt) to give waits in units of one millisecond.
If you're doing short waits, be careful of overflow on multiplication. 80000000 is roughly $05000000. If you multiply this by much more than 50, it will overflow.
Post Edited (Mike Green) : 10/2/2006 7:46:07 PM GMT
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
elseif byteval == "F"
··········· text.out(0)
··········· text.str(string("Received Command F ",13,13))
··········· text.str(word[noparse][[/noparse]@@reply1])
··········· waitcnt(clkfreq*2 + cnt)
··········· initialize·
Here is the DAT list:
reply1· WORD· "Communication with the Stamp is terminated",0
Where did I go wrong?
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
The "@@" operator is used when you have a table of addresses which is not the case here.
Mike
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
····· z := 0
····· repeat z from 0 to 41
······· text.str(@reply1[noparse][[/noparse]z])
····· waitcnt(clkfreq*5 + cnt)
and it displays the entire string.· Is there an expression I can substitute for "41" that defines the unknown length of a string?
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
compiles the same as
That's why you only got the first letter.
Normally, you can use STRSIZE(@reply1) to get the length of a string.
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
I have the Prop and the 6-LED touch switch working well.· The way it is set up, only the Stamp can terminate communications.· I would like for the Prop to be able to do the same - some sort of command like a Trap in PBasic that Prop would read after every operation, and if I pressed say "Q", the Prop would terminate and re-initialize both Stamp and Prop.· The re-initialzation I think I can handle, but I don't know how to do the Trap equivalent.
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
This won't do anything for the Stamp. You could have a reset command for the Stamp that you send (and interpret in your Stamp program) or you can bring the Stamp reset line to the Propeller and do a hardware reset using a Propeller pin.
PUB recData
· if· key.getkey == false·······················
··· byteval := serialIn(1,stampBaud,sim#NInv,8)
··· startin····
· else
··· initialize
What I was trying to say was "If no key has been pressed, go ahead and receive data.· If a key has been pressed then initialize".· It doesn't work.· The Prop can not receive a signal from the Stamp, but if I press a key, the Prop initializes.· I think my "if key.getkey" statement is wrong.
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
You really have to read the description of the routine you're using. In the standard keyboard driver (including the one in the OS), key.getkey reads:
If no key is available, the routine does hang waiting for one. You probably want to use "key.key" which returns a zero (false) if there's no key available and the actual key code if there is one.
PUB recData
· if key.key
··· byteval := serialIn(1,stampBaud,sim#NInv,8)
··· text.out(13)
··· start3
· else
···· text.str(string(13,"Propeller is terminating communications",13,13))
···· senddata("Q")
···· initialize
As soon as I opened communication with the Stamp, the Propeller immediately terminated it.· Did I write it correctly?
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
I think you've got it backwards. The "if key.key" succeeds if a key has been pressed. The "else" succeeds if no key has been pressed. You could try changing the if statement to "if key.key == 0"
Mike
I wrote:
PUB recData
· if key.key == 0
··· byteval := serialIn(1,stampBaud,sim#NInv,8)
··· startin····
··· text.out(13)
· else
···· text.str(string(13,"Propeller is terminating communications",13,13))
···· senddata("Q")
···· start1
What happens is that when I press a key to terminate, the Prop is already at the "byteval" instruction, so I must send one more command from the Stamp touch LED before Prop sees the key.key instruction, which it has stored.· This is not exactly what I wanted.· I don't think there is any really "clean" way to do what I want - I thought about making the key.key instruction a "repeat x" with a small delay, but if I made it long enough to give me time to press a key this would probably slow the program down to an unacceptable level.· I think I'll just go back to my original program and let the Stamp terminate communications.· Thanks for the help anyway - I've learned something new.
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Need a TV Module?
Newzed@aol.com
·
I have an Inventroy program that works fine.· If I enter "2803" the screen returns:
ULN2803· Qty 4
Press any key to continue
When the quantity of an item changes, I have to go into the DAT list and type in new figures.· I would like to be able to change the quantity of a part when I call it up.· I realize that I will have to rewrite the whole line - I can't just changed the quantity figure.· Here is the actual DAT entry:
item2Desc· byte "ULN2803··· Qty 4",0··
Can you tell me how to change it to:
item2Desc· byte "ULN2803··· Qty 3",0
on the fly, so to speak.
Thanks
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?
Newzed@aol.com
·
The descriptor strings could be changed, but what happens when the quantity goes from 9 to 10? That requires two characters in the string instead of one. If you still have the original example I wrote for you, you may remember that I used a separate binary value for the quantity and displayed it with the ".dec()" method. That was intended for just this purpose since it's easy to change a binary quantity. One question for you is "where are you going to store the inventory numbers when the Propeller is turned off?" Do you have extra EEPROM attached or some other kind of persistent memory? If so, what about backup? You can afford to reenter the coordinates of the mill if you have to, but reentering inventory numbers is not an option, particularly if you haven't kept a copy somewhere of the latest ones.
Mike
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?
Newzed@aol.com
·
You can change the DAT entry on the fly if you want to. You're just going to get burned the first time the power goes off and you lose the current inventory numbers.
Mike
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?
Newzed@aol.com
·