Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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: 175
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
    l298.JPG
    64.5 KB · Views: 341
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top