Problem with 89s52 program..

Status
Not open for further replies.

jagzviruz

New Member
Hi ..

I wrote the following code in Keil for a 89s52 and downloaded it to the chip..

It is only for the bot to move straight..I am using a L298HN ..the code ompiled successfully .. But the bot does not move .. I am getting a voltage reading of 3-4 volts at the Port 2 pins .. PLzz help me out ..
 

Attachments

  • forwardtest.c
    173 bytes · Views: 177
try this ok
//--------------------------------------------------------------------
#include<AT89x52.h>
int forward=0x33; //assum the code for for movement
int revers=0xD2; //assum the code for rev movement
//-----------------------------------------
void gofor();
void gorev();
void delay();
//-----------------------------------------
void main()
{
while(1){
gofor();
delay();
delay();
delay();
delay();
gorev();
delay();
delay();
delay();
delay();
}
return;
}
//-----------------------------------------
void gofor()
{
P2=forward;
}
//-----------------------------------------
void gorev()
{
P2=revers;
}
//-----------------------------------------
void delay()
{
for(;;
for(;;
}

//-----------------------------------------
 
Am attaching the l298 ckt that i am using

I have attached the l298 ckt that i am using .. will some one plzz look it up and tell me if it is correct or not
 

Attachments

  • l298.JPG
    64.5 KB · Views: 343
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…