Remote control by location (PIC in Oshonsoft)

Thread Starter

camerart

Joined Feb 25, 2013
3,840
Do you get the 1-2ms pulses from all pins rb0, rb1, rb2, if servos are disconnected?
Hi J,
Working:)
So, yes I get 3x 1-2mS from all PINs Rb0-2.
I was using smaller SERVOS for my tests and on closer inspection find that they are DIGITAL:oops:. I don't know much about digital SERVOs, but they do appear to work with a pulse?

I have the SERVOS +- volts connected to the power input (Battery) so lots of current, and the signal from the 3.3V PORTB.

I make Tricopters which have 3x motors and one SERVO for rudder. The SERVOs and motors all work with SERVO inputs, as we have been doing.

Thanks for your help, I can probably add more SERVOs myself, then include E,s get_mess section, then hopefully he will add his #137 CODE.

Here are 2x graphs for Digital and analog
C.
 

Attachments

Thread Starter

camerart

Joined Feb 25, 2013
3,840
Hi,
After a search for technical specifications, I found many general 'Google' type answers but here's a section from programmers, with interesting ideas.
From what I've read, some of them have an ON/OFF time totalling 2mS, where we have an ON between 1-2mS with no OFF time. The first method has a fixed 'duty time' of 20mS (I've read that this can be 25mS, but 22mS is safe) The second method has a variable 'duty time' unless we calculate 'tot' then the 'duty time' will always be 'say' 22mS.
I'll look at this later unless anyone thinks it should be done now.
C.
 

Attachments

Thread Starter

camerart

Joined Feb 25, 2013
3,840
Hi J,
I'm now trying to add all of the MAIN programs into one program, and had to change some parts of your CODE so it wouldn't clash.
Please check it's ok.
C.
 

Attachments

Thread Starter

camerart

Joined Feb 25, 2013
3,840
Hi,
I now have (I think) all of the sections of previous programs (5110-GPS-BMP280-MPU-9255...........Screen, gps, altimeter, compass) in one program. I've been checking that it compiles as I introduce them, but now it's very slow and stalls.
I think previously I had too many STRINGS, which caused this.

I have included the program, but it will have errors. If someone can run it through a Simulator, and let me know how to proceed please.
C.
 

Attachments

jjw

Joined Dec 24, 2013
823
The program is stuck in some interrupt.
I have not read enough about interrupts in the pic18f datasheet to help now.
Tried to comment out the other interrupts but no effect.
 

Thread Starter

camerart

Joined Feb 25, 2013
3,840
The program is stuck in some interrupt.
I have not read enough about interrupts in the pic18f datasheet to help now.
Tried to comment out the other interrupts but no effect.
Hi J,
It appears that the error is my transposing of your TMR1 CODE into the 'full' program. There are many register differences. I'll keep checking.
With the line marked !!!!!!!!!!!!!!!!!!!!!!!!!!!! commented out the program runs for a while.
C
 

Attachments

jjw

Joined Dec 24, 2013
823
If you comment out T1CON.TMR1ON = 1 then the servo part won't run ever.
You have gosub get_mess and many times goto get_mess.
This leads to a mess :)
 

ericgibbs

Joined Jan 29, 2010
21,459
hi guys,
If you write a debug trap

On Low Interrupt
Save System
Hserout "Low", CrLf
PIR1.TMR1IF = 0 'clear the TMR1 IF flag
T1CON.TMR1ON = 0 ' deleting this line, tmr1 keeps calling the Low Intr
Resume

You will see that the Program is using Timer1 in a Low Intr mode, it could be the Oshonsoft IDE.????

Eric
 

jjw

Joined Dec 24, 2013
823
hi guys,
If you write a debug trap

On Low Interrupt
Save System
Hserout "Low", CrLf
PIR1.TMR1IF = 0 'clear the TMR1 IF flag
T1CON.TMR1ON = 0 ' deleting this line, tmr1 keeps calling the Low Intr
Resume

You will see that the Program is using Timer1 in a Low Intr mode, it could be the Oshonsoft IDE.????

Eric
High intr for Timer1 is disabled.
Needs to change IPRI. TIMR1IP = 1
It was ok in the working servotest program!
Edit: Should be IPR1.TMR1IP = 1
 
Last edited:

Thread Starter

camerart

Joined Feb 25, 2013
3,840
If you comment out T1CON.TMR1ON = 1 then the servo part won't run ever.
You have gosub get_mess and many times goto get_mess.
This leads to a mess :)
Hi J,
I commented T1CON.TMR1ON = 1 out to see what would happen, and realise this isn't good programming, but it did indicate to me that this is the problem area (I think)

Actually E, mentioned something about goto 'get_mess' before, and I'm not sure quite how it should be implemented. In the 'get_mess' section is a reject so it doesn't run the whole CODE.

EDIT: I've yet to read after #173

C.
 

ericgibbs

Joined Jan 29, 2010
21,459
hi C,
When ever you get a program that hangs up, write a short debug trap as I did, it will highlight the problem area.
Which in your program was the wrong Tmr1 interrupt level.
The other debug feature is the Breakpoint window, I used that to see where the program was looping.

E
 

Thread Starter

camerart

Joined Feb 25, 2013
3,840
hi C,
When ever you get a program that hangs up, write a short debug trap as I did, it will highlight the problem area.
Which in your program was the wrong Tmr1 interrupt level.
The other debug feature is the Breakpoint window, I used that to see where the program was looping.

E
Hi E,
I tried your 'debug trap', and saw 'LOW' in the UART window. Is this the result of the test? I didn't actually follow???

Here is the latest program. It stalls at the line marked !!!!!!!!!!!!!!!!!!!!
Can you show us your test, and what we should expect please?
C.
 

Attachments

Top