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

Executing two tasks at the same time.

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



Joined: 13 Feb 2007
Posts: 10

View user's profile Send private message

Executing two tasks at the same time.
PostPosted: Tue Mar 20, 2007 2:44 pm     Reply with quote

I'm using the pic 12f675 to make two diferent oscilatory frequencies. While one is on High, the other is on Low.Unfortunelly there's a little delay between both of them. Is there a way to make these two frequencies flow together? Sorry for my terrible english....
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Mar 20, 2007 4:22 pm     Reply with quote

You need to write to the entire i/o port with one instruction.
Change your waveform bits in a byte variable. Then write
the variable to the i/o port. This will cause both edges
of the waveform to change at the same time.

Code:
#include <12F675.h>
#fuses INTRC_IO, NOWDT, NOMCLR, PUT, BROWNOUT
#use delay(clock=4000000)

#use fast_io(A)

//==========================
void main()
{
int8 tempA;

set_tris_a(0xFC);  // Pins A0 and A1 are outputs
tempA = 0;

while(1)
   {
    bit_set(tempA, 0);
    bit_clear(tempA, 1);
    output_a(tempA);
    delay_us(100);

    bit_set(tempA, 1);
    bit_clear(tempA, 0);
    output_a(tempA);
    delay_us(100);
   }

}
jtgoulart



Joined: 13 Feb 2007
Posts: 10

View user's profile Send private message

PostPosted: Tue Mar 20, 2007 6:30 pm     Reply with quote

OK, I'll try it. Thank you by the help.
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