View previous topic :: View next topic |
Author |
Message |
40inD
Joined: 30 Jul 2007 Posts: 112 Location: Moscow, Russia
|
18F2550 C4 C5 problem |
Posted: Thu Mar 14, 2019 2:50 pm |
|
|
When I try to toggle defined pins TRI1, TRI2 as C4 and C5 then nothing happens.
But if i define those pins for example as A1 and A2 then it works.
I can't understand, why C4 and C5 does not work?
Code: |
//============================
#include <18F2550.h>
#device ADC=8
#include <stdlib.h>
#fuses INTRC
#FUSES WDT2048
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOPBADEN //PORTB pins are configured as digital I/O on RESET
#FUSES NOLPT1OSC //Timer1 configured for higher power operation
#FUSES PUT
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#use delay(internal=8000000,RESTART_WDT)
#define TRI1 PIN_C4
#define TRI2 PIN_C5
void main()
{
setup_oscillator(OSC_8MHz);
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_DIV_64|ADC_TAD_MUL_20);
set_adc_channel(0);
//setup_WDT( WDT_2S);
while(TRUE)
{ output_high(TRI1);
output_high(TRI2);
delay_ms(100);
output_low(TRI1);
output_low(TRI2);
delay_ms(100);
}// while true
}
|
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Thu Mar 14, 2019 2:55 pm |
|
|
Well it's time to download the 438 page datasheet and read page 15 !
Table 1-2 will tell you why.....
If I say why, you won't remember for next time. Prof told me that back in '74.
Jay |
|
|
40inD
Joined: 30 Jul 2007 Posts: 112 Location: Moscow, Russia
|
|
Posted: Thu Mar 14, 2019 3:04 pm |
|
|
Thanks, I always forget about input-only pins. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Thu Mar 14, 2019 3:49 pm |
|
|
Ever since PICs grew more than 18 pins, you've needed to read the datasheet. It's amazing what they can jam into the epoxy these days !
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Fri Mar 15, 2019 4:06 am |
|
|
Actually I think you needed to read the sheet even when they were 18pin.
After all in those days you were having to learn about TRIS and which
pins took the power etc..
However it was a lot easier when the sheet was only about thirty pages
in total.... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Fri Mar 15, 2019 5:12 am |
|
|
re:
However it was a lot easier when the sheet was only about thirty pages
in total....
I'd do that while the PIC was being erased in the UV chamber.......
Jay |
|
|
|