View previous topic :: View next topic |
Author |
Message |
Ömer Faruk
Joined: 15 Nov 2018 Posts: 42 Location: Çanakkale
|
Problem with making pin_a5 of pic18f46k22 high |
Posted: Sun Mar 03, 2019 7:39 am |
|
|
Hello everyone
İ am having a problem with turning high pin_a5 of pic18f46k22.
İ made all configurations about Tris, ansel registers.
When i operate code output_high(pin_a5); i see 0.6 V on physical pin .When i operate output_low(pin_a5) i see 0V or vice versa .İ think there is a problem of SS1 which slave select for spi communication.But i dont use spi communication.İ use i2c communication with ds3231 with i2c module 1 . İ mean there are two i2c module in pic18f46k22.Can anybody help me? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sun Mar 03, 2019 8:46 am |
|
|
Generally speaking you need to disable the comaparator and analog peripherals that are attached to I/O pins when using simple in/out.
Depending on the PIC, the ADC section is the default NOT standardor basic I/O.
Also, check the board, perhaps there's a short or solder whisker betweeen that pin and the one next to it. |
|
|
Ömer Faruk
Joined: 15 Nov 2018 Posts: 42 Location: Çanakkale
|
|
Posted: Sun Mar 03, 2019 9:06 am |
|
|
temtronic wrote: | Generally speaking you need to disable the comaparator and analog peripherals that are attached to I/O pins when using simple in/out.
Depending on the PIC, the ADC section is the default NOT standardor basic I/O.
Also, check the board, perhaps there's a short or solder whisker betweeen that pin and the one next to it. |
Thank you for your reply i checked the pins for short circuit. pin_A5 and pin_E0 is short circuit. İ fixed it and problem solved. Thank you very much |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sun Mar 03, 2019 9:11 am |
|
|
GREAT !! Code: | //flash A5
#include <18f46k22.h> //processor
#include "46k22_fuses.h" //my fuses
#use delay(clock=16000000) //16MHz clock ( 8MHz worked as well)
#define led pin_a5 //pin with LED
main() {
while(TRUE) {
delay_ms(100); //delay for 1/2 second
output_toggle(led); //flip pin
} //end of while
} //end of main
|
above code I just tested and it works...
Jay |
|
|
|