Continue to Site

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.

how to increment an output pins!!!!

Status
Not open for further replies.

snoopcat

Junior Member level 1
Joined
Mar 28, 2007
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,357
please i'm beginner,i wanna generate deferent analog signal by using the dac08 and a PIC,how can i increment the output (PORTF for exemple)from 0x00 to 0xff using a loop of course
i wanna get something like that

f0 f1 f2 f3 f4 f5 f6 f7
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1
0 0 0 0 0 0 1 1
0 0 0 0 0 1 0 1
 

look at
**broken link removed**

or google "pic course"
 

Hi!
it should be something like this

unsigned char data=0;

TRISF = 0XFF; //ALL PINS OUTPUTS

while(1)
{
PORTF=data++;
if(data==0xff)
data=0;
delay();
}

void delay(void)
{
unsigned int i;
while(++i!=1000);
}


I have assumed that u are programming in C.
It can also be done in assembly quite easily.

I have used the delay function to generate some delay after sending a particular value to the port. You can increase or decrease this delay depending upon the type of signal that u want to generate.

Regards.

Added after 4 minutes:

I made one mistake (a terrible one)

in the above code make this change

TRISF = 0X00;

Thanks.
 

i think as our buddy has demonstrated is the right way to do
 

thnaks a lot guys ans sorry for the desargement
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top