CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

18F2550 C4 C5 problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
40inD



Joined: 30 Jul 2007
Posts: 112
Location: Moscow, Russia

View user's profile Send private message

18F2550 C4 C5 problem
PostPosted: Thu Mar 14, 2019 2:50 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 14, 2019 2:55 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 14, 2019 3:04 pm     Reply with quote

Thanks, I always forget about input-only pins.
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Mar 14, 2019 3:49 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Mar 15, 2019 4:06 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Mar 15, 2019 5:12 am     Reply with quote

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....... Very Happy

Jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group