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.

serial communiction through PICf452..ISIS simulation

Status
Not open for further replies.

ali shaheen

Junior Member level 1
Joined
Aug 29, 2010
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
pakistan, karachi
Activity points
1,419
hello,

i had developed a code and the schematic for serial communication through pic18f452 ...using max 232...and rs232 cable...I have used PROTEUS ISIS to simulate the circuit....the code below will work when the either one of the two cases goes true....and and it is working but the problem i am facing is that in simulation when I execute the program and load the hex file in the controller in simulation its not working on the keys i defined for clockwise and ant- clockwise direction but it is moving clockwise when i press '2' and anti clockwise when i press '6'......and also if i change the characters for input they are not working for them......only '2',and '6' are working through numeric keypad....while between execution in ISIS the vitual terminal is also not showing the characters or any junk value.......I hope i defined my problem in suitable manner....please help...am in a great great trouble.........

bestregards
ALI SHAHEEN
****************the code***************
//the code is in mikroCv8.2
//using pic18f452
unsigned short i;

void main() {
portd=0;
trisd=0;
portb=0;
trisb=0;

// Initialize USART module (8 bit, 9600 baud rate, no parity bit..)
Usart_Init(9600);

do {
if (Usart_Data_Ready()) { // If data is received
i = Usart_Read(); // Read the received data
switch(i)
{
case'3': //clockwise
portd.rd0=1 ;
portd.rd1=0;
////////////
PORTD.RD2=1; //OUTPUT
PORTD.RD3=0;
PORTD.RD4=0;
PORTD.RD5=0;
DELAY_MS(50);
//lcdshowclk();
PORTD.RD2=0; //OUTPUT
PORTD.RD3=0;
PORTD.RD4=1;
PORTD.RD5=0;
DELAY_MS(50);
// lcdshowclk();
PORTD.RD2=0; //OUTPUT
PORTD.RD3=1;
PORTD.RD4=0;
PORTD.RD5=0;
DELAY_MS(50);
// lcdshowclk();
PORTD.RD2=0; //OUTPUT
PORTD.RD3=0;
PORTD.RD4=0;
PORTD.RD5=1;
DELAY_MS(50);
break;
case'2': //anticlockwise
portd.rd0=0 ;
portd.rd1=1;

////////////
PORTD.RD2=0; //OUTPUT
PORTD.RD3=0;
PORTD.RD4=0;
PORTD.RD5=1;
DELAY_MS(50);
//lcdshowanticlk();
PORTD.RD2=0; //OUTPUT
PORTD.RD3=1;
PORTD.RD4=0;
PORTD.RD5=0;
DELAY_MS(50);
//lcdshowanticlk();
PORTD.RD2=0; //OUTPUT
PORTD.RD3=0;
PORTD.RD4=1;
PORTD.RD5=0;
DELAY_MS(50);
//lcdshowanticlk();
PORTD.RD2=1; //OUTPUT
PORTD.RD3=0;
PORTD.RD4=0;
PORTD.RD5=0;
DELAY_MS(50);

break;


}
}
} while (1);
}//~!
 

Dear Ali;
This is irshad Baig from Karachi . I m glad to hear you also from KHI. Can you tell me on my cell no what problem you are facing in serial of PIC. my cell no is 03218271102
 

Dear Sir;

Thank you sir for your consideration...but i came across a solution of this problem....and that is , I dont have to use max232 in PROTEUS SIMULATION......

regards
ALI SHAHEEN
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top