Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Looking for PIC16F877A code for 6 pulse generation

Status
Not open for further replies.

gayathrisankar

Newbie level 3
Joined
Jan 2, 2008
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,305
i'm in need of pic 16f877a coding for 6 pulse generation. can any one help me?
 

drbizzarow

Advanced Member level 1
Joined
May 24, 2006
Messages
416
Helped
25
Reputation
50
Reaction score
15
Trophy points
1,298
Activity points
3,653
Re: pic16F877A

gayathrisankar said:
i'm in need of pic 16f877a coding for 6 pulse generation. can any one help me?
please alobrate the problem do u wan generate 6 diffrent pulses at a time ?
 

gayathrisankar

Newbie level 3
Joined
Jan 2, 2008
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,305
Re: pic16F877A

i need embedded c code or assembly code for the pic16F877A.I want to get the output as follows in the output port.... each value with the delay of .833 msec... each set of following values should repeat twice per cycle.

d0 d1 d2 d3 d4 d5 d6 d7 d8 will be as follows for infinity number of times.(continous output)

00100110
00100010

00100111
00101010

00101001
00101000

00011001
00001000

00011010
00001010

i've attached turbo c code here..........

#include<stdio.h>
#include<conio.h>
#include<dos.h>
main()
{
int i;
clrscr();
while(1)
{
for(i=0;i<2;i++)
{
outportb(0x378,38);
delay(0.8333);
outportb(0x378,34);
delay(0.8333);
}
for(i=0;i<2;i++)
{
outportb(0x378,37);
delay(0.8333);
outportb(0x378,32);
delay(0.8333);
}
for(i=0;i<2;i++)
{
outportb(0x378,41);
delay(0.8333);
outportb(0x378,40);
delay(0.8333);
}
for(i=0;i<2;i++)
{
outportb(0x378,25);
delay(0.8333);
outportb(0x378,8);
delay(0.8333);
}
for(i=0;i<2;i++)
{
outportb(0x378,26);
delay(0.8333);
outportb(0x378,10);
delay(0.8333);
}
for(i=0;i<2;i++)
{
outportb(0x378,22);
delay(0.8333);
outportb(0x378,2);
delay(0.8333);
}
}
}
 

MAKH

Newbie level 3
Joined
Feb 24, 2008
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,303
Re: pic16F877A

gayathrisankar said:
i'm in need of pic 16f877a coding for 6 pulse generation. can any one help me?

Check this one(ccs compiler,xtal=20MHz):

#include <16f877A.h>
#use delay(clock=20000000)
#ZERO_RAM

///////////////////////////// variables ///////////////////////////////////////

int1 bit_0;
int16 mil;

///////////////////////////////////////////////////////////////////////////////

#int_CCP1
void CCP1_isr()
{
mil++;
switch(mil)
{
case 832:
mil=0;
break;
case 1: //for each pin , add one case
bit_0^=1;//x or
output_bit(pin_b0,bit);
break;
}

}

///////////////////////////////////////////////////////////////////////////////

void initialize()
{

setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
setup_ccp1(CCP_COMPARE_RESET_TIMER);

CCP_1=5000;

enable_interrupts(INT_CCP1);
enable_interrupts(GLOBAL);

}

///////////////////////////////////////////////////////////////////////////////

void main()
{
initialize();
while(1);
}

////////////////////////////////////////////////////////////////////////////////end

You better use CCP1 so your program becomes simpler
 

ldanielrosa

Member level 4
Joined
Feb 24, 2007
Messages
71
Helped
8
Reputation
16
Reaction score
2
Trophy points
1,288
Activity points
1,722
pic16F877A

If this is for a school project, please don't ask someone else to do your homework.

As for the question at hand- what is the goal? Are you trying to make a 60Hz 3 phase power inverter? If you only want to control pulses going out on 6 I/O pins every 8333uS, then you may be a lot happier doing this from a timed interrupt.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top