Quantcast
Channel: MEL PICBASIC Forum
Viewing all articles
Browse latest Browse all 4787

Nokia 3310 and servo motors

$
0
0
Can someone take a look at my code and tell me why my RC servos won't move when I use the include LCD_3310v32.inc. If I remove that include the program works as it should. I have a project that I'm working on that could really use the LCD for feedback, without being tethered to a computer via USB port. The program compile and runs just the servos don't move. Again if I remove the Include the servos do exactly as programmed. I'm totally stumped!

Code:

DEFINE OSC 48
DEFINE ADC_BITS 8
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50

'Include "modedefs.bas"      ' Include serial modes.
'include "LCD_3310v32.inc" 

ADCON1 = %00001011

Pulse var word
TRISA = %00000000
TRISB = %00000000
TRISC = %00000000

Start:
Pulse = 0
PORTB.1 = 1
for Pulse = 1000 to 1500 step 1
    PORTC.0 = 1
    pauseus Pulse
    PORTC.0 = 0
    pause 15
next Pulse 
PORTB.1 = 0
pause 250
PORTB.1 = 1 
for Pulse = 1500 to 1000 step -1
    PORTC.0 = 1
    pauseus Pulse
    PORTC.0 = 0
    pause 15
next Pulse 
PORTB.1 = 0

PORTB.1 = 1
for Pulse = 1000 to 2000 step 1
    PORTC.1 = 1
    pauseus Pulse
    PORTC.1 = 0
    pause 15
next Pulse 
PORTB.1 = 0
pause 250
PORTB.1 = 1 
for Pulse = 2000 to 1000 step -1
    PORTC.1 = 1
    pauseus Pulse
    PORTC.1 = 0
    pause 15
next Pulse 
PORTB.1 = 0
Goto Start

All the code does is move two servos through their rotations left and right. It took me two days of troubleshooting to figure out what the problem was. But looking over the include file I still cannot find the problem. I've looked through the forum and haven't found this problem.
Any help is greatly appreciated!
Larry
Attached Files

Viewing all articles
Browse latest Browse all 4787

Trending Articles