Hi All!
Again I have the infamous IDC timeout. I believe the wiring is correct and just in case , maybe I missed something in the code? Thanks, Ed
'************************************************* ***************
'* Name : SERVO ANGLE.BAS *
'* Author : Ed Cannady *
'* Notice : Copyright (c) 2012 Copyright (c) 2012 *
'* : All Rights Reserved *
'* Date : 5/20/2012 *
'* Version : 1.0 *
'* Notes :16F628A *
'* : *
'************************************************* ***************
Include "Modedefs.bas"
Define LOADER_USED 1
' ** Set Xtal Value in mHz **
Define OSC 20 ' Set Xtal Frequency
' ** Declare Pins Used **
CMCON=7
INPUT PortA.0 ' Data is clocked on rising edge of this pin
' ** Variables **
Rawpulse Var Word ' Measured input pulse width
Trueangle Var Word ' Calculated Servo Angle
' ***** MAIN PROGRAM *****
Again:
Pulsin PORTA.0,1,Rawpulse ' Measure the input pulse width on pin 17 (RA0)
Trueangle=(((Rawpulse-15)*18)*100) ' Calculate Servo position angle
pause 150
goto Again
Bookmarks