Need help about embedded C programming - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Need help about embedded C programming

maheshbestmaheshbest Posts: 1Member
Hi all,
I need some info about below program for embedded C,

void main (void ){
unsigned char mybyte;
P1=0xFF; // make port input enabled
while (1){
mybyte=P1;
MSDelay(500);
P2=mybyte; // buzzer signal
}
}

In above program, 0xFF signal is sent to port 1 for enabling it for input.
Now if, i am passing 0xFF as an input signal to port 1 then the same data will get assigned to mybyte and after that it will be sent to P2.
Now my question is, will P2 become input enabled or it will just send that data to output device?
How does the port differentiate between output signal and latch signal?

Regards,
Mahesh Kedari

Comments

  • LundinLundin Posts: 3,711Member
    Typically, microcontrollers have at least 2 registers per port: one for data direction (input/output) and one for the actual data.

    How your particular microcontroller works, I have no idea. Might be wise posting which one it is if you expect better replies...
Sign In or Register to comment.