| 
	
	|  |  |  
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| E_Blue 
 
 
 Joined: 13 Apr 2011
 Posts: 417
 
 
 
			    
 
 | 
			
				| Invalid Pre-Processor directive Invalid Pin |  
				|  Posted: Wed Jul 31, 2019 7:37 am |   |  
				| 
 |  
				| I'm using MPLAB X IDE v5.15, CCS v5.078 to develop the firmware for a PIC24FJ1024GB606. 
 I need two USARTs and two SPI, so I defined those pins this way
 
 
  	  | Code: |  	  | //GSM
 #pin_select U1TX=PIN_B7
 #pin_select U1RX=PIN_B6
 #pin_select U1CTS=PIN_B9;//IN
 #pin_select U1RTS=PIN_B8;//OUT
 
 //GPS
 #pin_select U2TX=PIN_D5
 #pin_select U2RX=PIN_G9
 
 //ACELEROMETER BUS
 #pin_select SDI1=PIN_D3;//INPUT
 #pin_select SDO1=PIN_D4;//OUT
 #pin_select SCK1OUT=PIN_D2;
 
 //MEMORY BUS
 #pin_select SDI2=PIN_B4;//INPUT
 #pin_select SDO2=PIN_B5;//OUT
 #pin_select SCK2OUT=PIN_B0;
 
 
 #use rs232(UART1,stream=GSM,NOINIT)
 #use rs232(UART2,stream=GPS,NOINIT)
 
 #use fast_io (ALL)
 | 
 
 All is ok except the CTS/RTS and the SPI definitions.
 I'm new on 16bit microcontrollers so probably I just made a really dumb mistake.
 
 Would you help me please?
 _________________
 Electric Blue
 |  |  
		|  |  
		| temtronic 
 
 
 Joined: 01 Jul 2010
 Posts: 9588
 Location: Greensville,Ontario
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Jul 31, 2019 8:21 am |   |  
				| 
 |  
				| Quick comment... While I don't use that PIC but.. the error looks like you're trying to use a pin that cannot be used as you want.
 You'll have to look/read the section on 'pin select' and see what's legal to use. Not all pins can be connected to all internal peripherals.......
 
 Jay
 |  |  
		|  |  
		| E_Blue 
 
 
 Joined: 13 Apr 2011
 Posts: 417
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Jul 31, 2019 8:48 am |   |  
				| 
 |  
				| Yes, I read the header file. 
 
  	  | Code: |  	  | // #pin_select function=pin // Valid Pins:
 //    PIN_B0,PIN_B1,PIN_D8,PIN_D10,PIN_D9,PIN_B6,PIN_B7,PIN_B8,PIN_B9,PIN_F4,
 //    PIN_D0,PIN_D11,PIN_B2,PIN_B14,PIN_F3,PIN_F5,PIN_B5,PIN_G8,PIN_D5,PIN_G6,
 //    PIN_D3,PIN_D2,PIN_D1,PIN_D4,PIN_G7,PIN_G9,PIN_B4,PIN_B15,PIN_C14
 // Input Functions:
 //    OCTRIG1,INT1,INT2,INT3,INT4,OCTRIG2,T2CK,T3CK,T4CK,T5CK,IC1,IC2,IC3,OCFA,
 //    OCFB,CCPCKIA,CCPCKIB,U3RX,U1RX,U1CTS,U2RX,U2CTS,SDI1,SCK1IN,SS1IN,U3CTS,
 //    SDI2,SCK2IN,SS2IN,TMRCLK,CLCINA,CLCINB,U4RX,U4CTS,SDI3,SCK3IN,SS3IN
 // Output Functions:
 //    NULL,C1OUT,C2OUT,U1TX,U1RTS,U2TX,U2RTS,SDO1,SCK1OUT,SS1OUT,SDO2,SCK2OUT,
 //    SS2OUT,OC1,OC2,OC3,CCP4OUT,CCP5OUT,CCP6OUT,U3TX,U3RTS,U4TX,U4RTS,SDO3,
 //    SCK3OUT,SS3OUT,C3OUT,CCP7OUT,REFCLK,CLC1OUT,CLC2OUT,RTCCOUT
 //
 
 | 
 _________________
 Electric Blue
 |  |  
		|  |  
		| newguy 
 
 
 Joined: 24 Jun 2004
 Posts: 1924
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Jul 31, 2019 9:24 am |   |  
				| 
 |  
				| Something similar was discussed here less than a week ago if I remember correctly. For SPI functionality you also have to specify a serial clock in pin. Read the topic below and see if it makes at least some of the errors go away. 
 http://www.ccsinfo.com/forum/viewtopic.php?t=58142
 |  |  
		|  |  
		| temtronic 
 
 
 Joined: 01 Jul 2010
 Posts: 9588
 Location: Greensville,Ontario
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Jul 31, 2019 9:47 am |   |  
				| 
 |  
				| I'd still read the Microchip datasheet ! There could be a 'bug' in the compiler, always best to confirm with the manufacturer of the PIC to know what's legal. |  |  
		|  |  
		| E_Blue 
 
 
 Joined: 13 Apr 2011
 Posts: 417
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Jul 31, 2019 1:38 pm |   |  
				| 
 |  
				| I found the mistake and as I had said it was really silly. 
 The mistake is that preprocessor commands DOESN'T NEED A SEMICOLON!!!
   
 What an idiot!!
  _________________
 Electric Blue
 |  |  
		|  |  
		| Ttelmah 
 
 
 Joined: 11 Mar 2010
 Posts: 19966
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Jul 31, 2019 2:05 pm |   |  
				| 
 |  
				| Been there. Got the 'T' shirt... 
 If I had a pound for every 'silly' like that I did, I'd be richer than master B.
 Gates!.
 |  |  
		|  |  
		|  |  
  
	| 
 
 | 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
 
 |