CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Pulse Steering

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jake1272



Joined: 15 Mar 2021
Posts: 37

View user's profile Send private message

Pulse Steering
PostPosted: Mon Apr 05, 2021 7:52 am     Reply with quote

Hi everyone,
How do I implement a pulse at 10Hz and output to each of the 4 pulse steering pins every second?

Code:
 //Pulse steering example
//Use CCP_PULSE_STEERING_X, where X= A,B,C or D
//Can also use multiple outputs ORd together
#include <16F1847.h>
#fuses INTRC_IO,NOWDT,NOPROTECT,NOLVP,MCLR
#use delay(clock=8000000)
#use rs232(baud=9600, UART1 ,Errors)
void main (){
setup_timer_2(T2_DIV_BY_16,207,1); //sets Freq = 600Hz
setup_ccp1(CCP_PWM | CCP_PULSE_STEERING_B); //Sends to PIN_B5
set_pwm1_duty(416L); //Sets 50% duty cycle

while(1);
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Mon Apr 05, 2021 11:45 am     Reply with quote

Just send new pulse steering commands at one second intervals.
How you time this is up to you. You could just delay, or use a timer
interrupt.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group