2
Good afternoon, I want to toggle a PIC pin set as output for input in the middle of running the program, and then turn the pin as output.
2
Good afternoon, I want to toggle a PIC pin set as output for input in the middle of running the program, and then turn the pin as output.
1
uses the directive:
#use standard_io(A)
then just use the normal functions for reading and writing: input (pin), output_high (pin) and output_low(pin).
1
You have two options using directives #USE STANDARD_IO(port) or #USE FAST_IO(port):
Upside: It "takes care" of the direction of the pins. So when you use input(pin), output_high(pin) or output_low(pin) you don’t have to worry about setting the direction of the pins.
Downside: When you do a reading or writing it is always generated more code to set the direction of the pin, even without need. This way uses more memory and this can be a problem depending on the size of your firmware and the available memory of your µControlator.
Upside: Uses less memory because it only generates the code needed to read or write to the pin.
Downside: You have to be careful and set the direction of the pin before reading or writing using the command set_tris_x(value)
Browser other questions tagged pic
You are not signed in. Login or sign up in order to post.