jrd660
Newbie level 2
Gday all.
New here to the forum and need some assistance.
I'm programming a 16F88 for servo signals based on 20ms frame rate and 1-2ms mark time (For an ESC brushless motor control). So far, the success has not been good. As a cut down basic version of the code (I cut away all the extra parts of code to get just the basics of timing and an output to a pin for testing), here's what it looks like
TRISB = %00000000
begin:
PORTB.4 = True
WaitUs 1000
PORTB.4 = False
WaitUs 19000
Goto begin
End
It's simple enough: Port high, wait 1ms, port low, wait 19ms, repeat....
Programmed with OshonSoft, chip burned with PICkit 2 and run on a breadboard from a fixed 5V line on a variable PS.
Configuration Bits:
Flash program code protection - OFF
CCP1 multiplex selection - RB3
In-circuit debug - Disabled
Flash program write protection - OFF
EEPROM protection - OFF
Low voltage ICSP - Disabled
Brown-out reset - Enabled
RA5/MCLR selection - Digital Input
Power up timer - Enabled
WDT - Disabled
Oscillator selection - INTOSC
Internal/External switchover mode - Disabled
Fail-safe clock monitor - Disabled
Here's the problem... The Mark/Space timing is completely wrong. (First apparent when trying to use TMR0 interrupt)
Here's the details -
test 1:
1 Mhz Internal Clock:
Total simulated time = 20056uS, measured mark time = 0.024Secs, measured mark/space time = 0.616Secs
Test 2:
4 Mhz Internal Clock:
Total simulated time = 20014uS, measured mark time = 0.12Secs, measured mark/space time = 2.48Secs
Test 3:
8 Mhz Internal Clock:
Total simulated time = 20007uS, measured mark time = 0.28Secs, measured mark/space time = 4.96Secs
The same code compiled and run on a 16F628A work perfect.
I'm guessing I haven't set the 88's (I've tried 5 of them, presumably from the same manufacture batch) and they're all the same.
Not new to PIC programming, but I'm not an expert in them. I am new to 88's, so I've probably missed something along the way.
I'd appreciate any clues that someone may have.
Thanks
New here to the forum and need some assistance.
I'm programming a 16F88 for servo signals based on 20ms frame rate and 1-2ms mark time (For an ESC brushless motor control). So far, the success has not been good. As a cut down basic version of the code (I cut away all the extra parts of code to get just the basics of timing and an output to a pin for testing), here's what it looks like
TRISB = %00000000
begin:
PORTB.4 = True
WaitUs 1000
PORTB.4 = False
WaitUs 19000
Goto begin
End
It's simple enough: Port high, wait 1ms, port low, wait 19ms, repeat....
Programmed with OshonSoft, chip burned with PICkit 2 and run on a breadboard from a fixed 5V line on a variable PS.
Configuration Bits:
Flash program code protection - OFF
CCP1 multiplex selection - RB3
In-circuit debug - Disabled
Flash program write protection - OFF
EEPROM protection - OFF
Low voltage ICSP - Disabled
Brown-out reset - Enabled
RA5/MCLR selection - Digital Input
Power up timer - Enabled
WDT - Disabled
Oscillator selection - INTOSC
Internal/External switchover mode - Disabled
Fail-safe clock monitor - Disabled
Here's the problem... The Mark/Space timing is completely wrong. (First apparent when trying to use TMR0 interrupt)
Here's the details -
test 1:
1 Mhz Internal Clock:
Total simulated time = 20056uS, measured mark time = 0.024Secs, measured mark/space time = 0.616Secs
Test 2:
4 Mhz Internal Clock:
Total simulated time = 20014uS, measured mark time = 0.12Secs, measured mark/space time = 2.48Secs
Test 3:
8 Mhz Internal Clock:
Total simulated time = 20007uS, measured mark time = 0.28Secs, measured mark/space time = 4.96Secs
The same code compiled and run on a 16F628A work perfect.
I'm guessing I haven't set the 88's (I've tried 5 of them, presumably from the same manufacture batch) and they're all the same.
Not new to PIC programming, but I'm not an expert in them. I am new to 88's, so I've probably missed something along the way.
I'd appreciate any clues that someone may have.
Thanks