fdserial between two propeller 'flip' modules.; A Reopening
bbrien Posts: 528
edited 2022-02-14 06:39 in General Discussion
I having lots of problems with fdserial with two flips. I am using propeller C. Flip1 is running a program which uses 5 switches, 1 for speed and four for directions. The final output sends four bytes(0-255) by means of
fdserial_txChar(RmotorPin); fdserial_txChar(RdirPin); fdserial_txChar(DmotorPin); fdserial_txChar(DdirPin);now my understanding is that the commands send a byte to the transmit buffer. the next question is do I setup the buffers in the (MAIN) or not.When the second flip reads the input (rxpin) nothing happens.Sending the files. Can you please check them. I think I may need a receive buffer.
Based on the master program do you have pin 3 (TX) on master wired to pin 0 (RX) on slave flip wired together. Data send by master program will be send and received to an internal buffer on the receiving flip. No buffers required.
On the master flip set pin 3 high and on the slave flip read the state of pin 0. If you see it does return a high value then it worked.
Now change the master program and set pin 3 low and see if you can see a low value on pin 0. If this all works then serial should work as well.
Master program test
Slave program test
The Slave program will output the state of pin 0 every second on the terminal screen.
2; I have two new flips,should not have any damages unless factory defects.
3; will try the new tests
The Arduino code has to worry about Input, Output, Pull up, Pull down, Analog, Digital as some pins have special functions and can be connected to internal timers.
There are two programs. One to run on the master and the other to run on the slave flip. The master will set the pin state that is wired to the slave and the slave program will tell you what the state of that pin is. If everything is wired up correctly the state of the pin will change as the master program runs. Sort of like serial data running in slow motion.
So pin 3 on master would be your transmit(tx) pin 3 and pin 0 on the slave would be the receive(rx).
These program will run two test. The first is as before setting a pin high and then low.
The second test actually send a character using serial.
In the program is a define for TEST which can be set to 0 for test 1 or 1 for test 2. Each program will display what it is doing.
Most problems due to damaged io's. Changing from PWM to frequency (4 - 80 Hz) generation. Does anyone have Square_wave method.
I've reopened this thread with these new files . I am changing to a frequency generation around 4 - 80 Hz. Does any one have the Square_wave method available.
There is a SquareWave function built into the SimpleTools library.
It looks like there is a Square_Wave function that you call where you put in the Pin, Channel (counter), and Frequency.
There used to be a webpage that listed all the functions and how to use them.
I tried to find them but couldn't get in. Maybe I could use the data for the serial in the spin program.
Regarding the program shown below ;where should the method "square_wave" Be inserted ? , where it is now or elsewhere.I get an error at b1 = input(4); "expected a Declaration or statement at end of input"
How sand when do I use the Void statement as in "void square_wave"
Square_Wave is VOID because it doesn't return anything.
Call this function to stop.
Now for the stupid questions so forgive me.
Can more than one button on the HandBox be pressed at the same time?
I assume the HandBox takes over from the AutoGuider when a button is pressed.
Is the Telescope always moving or can it be turned off and if so how?
Anything else that you can think of so the program is structured correctly.
Buttons work and motor control works, so now it's putting everything together.
Since the HandBox only has switches currently, why not just send which switch is active at that moment.
The BrainBox on the telescope should determine what to do based on what is in control at that moment.
A State Machine makes that easy because the State will change as the inputs change, and each State will move the Motors differently.
There is Manual Control, AutoGuiding, No Guiding (Move with the Earth), and then North, South, East, and West.
If I remember correctly West is the default direction to counter the Earth's movement.
Let me know if I am missing anything.
As I have said before the Hand box has a brain which communicate by serial. Yeah The mount has a on-off switch.
Hand Box is the Master and the mount is the slave. The auto guider is a secondary system.
The hand box is manual control with N,S,E,W,
Check out post #22, Since I am using two counters it is possible but not normally.
Auto Guide also has N,S,E,W, . The Last Is Tracking Which is sidereal, or for the rotation of the earth. It doesn't matter at this time.
Where would I insert the "Square_Wave Stop in the Program. Also tested and no RmotorPin or DmotorPin output
and have several errors
In the Switch...Case statement why do you have IF statements?
The Case statement will only execute when that button was pressed and to the program a human will take an eternity to release it.
I am not familiar with how telescopes work so do the motors normally run one at a time or do they both sometimes run at the same time.
Unfortunately Square_Wave_Stop kills everything so it may be best to just change the pin and rate depending on the direction.
Are you doing Astrophotography or is that your end goal or are you just observing objects.
I ask because movement especially for RA is critical for astrophotography since the object must remain in the same spot to get clear image.
When I started this project a Poster by the name of "Iseries" Convert the Arduino Program to Propeller C. It was originally written by an Arduino programmer so I never changed it.
2) It is possible to use two motors at once but I usually only run one at a time.
3) I observe but sometimes I use a DSLR to take Photos. I also use a Live feed video camera which is able to image a Stacked 85 second image. The DSLR can only be used on a 6 inch scope which I can use on the mount.