Yeah thats the same kind of assembly compile error I recieved “not word for word” but close enough.
Is there any other documentation besides snippits of sample code for the atom pro? I find some of the commands listed in the atom pro pdf are somewhat lacking and would like real code examples…
I with you on that. I, too, think some of the command explanations could be elaborated on. A LOT of the parameters leave to lot to be desired. But for what it is/does, I’m glad its available.
I really enjoy looking at simple code rather then starting with Xan and Zenta’s code for there pheonix’s
It would be cool of the basic micro software showed you issues with the code before you hit compile sorta how VB does it with underlines or bold’ing out pieces of code to let you know they are incorrect. Granted Ive made an led blink and a servo move back and forth although the servo position seems like i can move the servo further while its connected to a futaba receiver.
The undefined reference to _LETFUNC is definitely an assembler error. If that is the complete code that causes the error I’ll try it and fix the problem. If not please post the complete program so I can find the error.
Also just so you know, GetHservo will get the current position of the specified servo at that instant(as far as the hservo command knows it anyway). If the servo is moving to a new location the value will be whatever it is at that moment, not the position it will be at when it is finished moving.
Also until the servo has been told to move somewhere the first time, the position is unknown. The hservo system does not have any means of asking the servo what position it is at. Most servos have no means of getting this information from them and the few that do use propriatery methods to send that information back. What the hservo system does is keep track of where that servo is supposed to be at based on the positions and speeds used in the hservo command. The first hservo command you run for a particualr servo should have a speed of 0 because the previous position is unknown. After the servo is in a known position then you can use a speed setting to move to a new position at a specific speed.
The HSERVO commands are not documented at all in the current manual(I don’t think). We will be updating the manual but currently the push has been other places(eg the compiler itself). if you have specific questions on any command please let me know. I’ll be happy to help describe them better and give you examples of how they function.
humm I guess i’m missing something here, why is it that this code dosent work its so simple?
you enable the servo, tell it to go to a location then its there or getting there
the position is stored into "pos’ slong variable then it loops through that constantly getting the position of the p1 servo and applying that to p0 servo…
Because a standard RC servo has no means to tell anything else where it is at. It simply moves to where the pulses sent to it indicate. If you move the servo to a new position by hand there is no method to get that information from the servo into the microcontroller. Using a servo in this way is not possible(at least not with any standard RC servos).
I don’t know if there is anything preventing it from compiling, but the overall concept is flawed. Your program never initializes a servo move for the servo on p1. How can you ask for the servo position on p1 when the program has never told it to move? The idea behind get h servo is to get the position the servo is being told to go to while it’s moving. It’s not intended to just show where the servo on that pin is…
Yes setting the position to 0 should set the servo to what the servo thinks is it’s center. However the first time you set a servo position you should not use a speed or set the speed to 0(eg inifinite) because there is no known previous position to work with. If you try to use a speed the first time you set the servo position you may(probably) get unexpected results because the hservo command has no valid preious position to calculate the servo pulse based on the speed.
Hservo determines the pulse to send every 20ms to the servo depending on the speed set and the previous position. If there is no previous position then it will be using bad information(ie random position values because they were never initilized) to try to determine what each pulse width sent to the servo should be every 20ms which could cause your servo to act unexpectedly(ie shoot all the way to one side or the other before moving to the final position you set it to).
This will send the servo to it’s center(start sending a 1.5ms pulse immediately).
Just to clarify using hservo:
Use hservo to set an inital position(hservo [p0/0/0]). Hservo will start sending out the pulse for the center of the servo(a 1.5ms pulse width every 20ms which is 24000 clock cycles on a 16mhz atompro module). Then if you give a new hservo command with a speed of 1000(hservo [p0/12000/1000]) hservo will calculate the next position to send would be a pulse of 25000 clock cycles. And every 20ms after that it would add 1000 clock cycles to the pulse width until it got to 36000 clock cycles. This is how hservo “knows” the position of the servo. It assumes that the pulse it outputs is where the servo is at. But if you use to high a speed the servo won’t keep up and the “position” returned by gethservo will be incorrect.
Also fixed the undefined reference to LETFUNC in the GETHSERVO command. This error would only show up if you never used a LET anywhere in your program(eg temp=###). Since your example program was so simple LET was never used anywhere else and GETHSERVO did not include the LET function like it should have. The next update will have this fixed.
Humm well’s then, Is it possible for that application to act more like visual basic?
Underlining incorrect code highlighting errors excreta so you know your code is bad before you hit compile? more interaction so you know what to type, what variables are available to you, maybe some sort of code reference in the program with code examples for specific snippits…