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.

MOVING MESSAGE HELP PLS

Status
Not open for further replies.

syrax

Full Member level 3
Joined
Sep 15, 2005
Messages
183
Helped
11
Reputation
22
Reaction score
3
Trophy points
1,298
Activity points
2,620
I want to make a moving dot /in some modes/ using at89c51 and 74hc595
how to write the program , i using Keil C compiler but I have some problems with code . How to make this project with 3-4 74595


please help


thanks
 

Maybe you can get some ideas here:


best regards
 

may be this sourse code can help u
 

I can't put a bit in Data port, I use P1 for 74hc595, but when try to put a single bit from "char" there is nothing hapened

my source in K**l
BEGIN

#include <stdio.h>
#include <reg51.h>

sbit Data = P1^0;
sbit Pulse = P1^1;
sbit Lach = P1^2;
bit Carry = 0x03^0; ????????? i saw that in other code lilke 0x03.3


unsigned char t = 0x01;
unsigned char s = 0xC0;

void delay (const unsigned int);
void init(void);
void hcOut(unsigned int w);

void main(void)
{
init();
hcOut(0x0001);
}


void delay(const unsigned int period)
{
unsigned int x, y;
for (x = 0; x<= period; x++)
{
for(y=0; y<=60; y++);
}
}
void init (void)
{
P1 = 0x00;
P3 = 0x00;
P2 = 0x00;
Lach = 1;
Pulse = 0;

}
void hcOut(unsigned int w)
{
int q;
for(q =1; q<=16; ++q)
{
////////////HERE IS THE PROBLEM MAY BE //////////////////////
if (w^0 == 0){Data = 0;}
else if(w^1 == 1){Data = 1;}
w<<=1;
// Data = w^q;
Pulse = 1;
delay(10);
Pulse = 0;
delay(10);
/////////////--------------------------------------///////////////////
}
Lach = 0;
delay(10);
Lach = 1;
}

END

When i write a code One of my Port change hes state /like a counter/ i have no need of interups
 

Try this:
////////////HERE IS THE PROBLEM MAY BE //////////////////////
if (w & 1){Data = 1;}
else {Data = 0;}
w>>=1;

You should also put an endless loop into main like this otherwise your program will restart continuosly:

void main(void)
{
init();

for(;;)
hcOut(0x0001);
}

hope this helps and best regards
 

THANKS THANK THANKS
it's work perfect
:)))))))))))))))))))))))))))))))))
 

how can i put some variables in flash i try 0x000000, but the plase is to small

in order i make my program like:
3 groups
OOOOOOOO|OOOOOOOO|OOOOOOOO
hcOut(0xsample, 0x00, 0x00)
hcOut(0x00, 0xsample, 0x00)
hcOut(0x00, 0x00, 0xsample)
this program run single dot

my idea is to connect a button to kontrol the mode of moving
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top