View previous topic :: View next topic |
Author |
Message |
richi-d
Joined: 28 Aug 2007 Posts: 106
|
PIC24/PCD doesn't work |
Posted: Tue Apr 07, 2009 8:15 am |
|
|
I try to make a very simple program, but this is not running. The pin doesn't toggle. Oscillator is running. Do I have to map the output pins somehow?
Code: |
#include <24FJ128GA006.h>
#FUSES FRC_PLL,NOPROTECT,NOIESO,NOJTAG,ICSP1,DEBUG
#use delay (clock=32000000)
#USE STANDARD_IO(B)
#USE STANDARD_IO(C)
#USE STANDARD_IO(D)
#USE STANDARD_IO(E)
#USE STANDARD_IO(F)
#USE STANDARD_IO(G)
#define _NOP #asm NOP #endasm;
#define RD PIN_E0
#define WR PIN_E1
#define A0 PIN_E2
#define RST PIN_E3
#define CS PIN_E4
#define DATA_0 PIN_D7
#define DATA_1 PIN_D6
#define DATA_2 PIN_D5
#define DATA_3 PIN_D4
#define DATA_4 PIN_D3
#define DATA_5 PIN_D2
#define DATA_6 PIN_D1
#define DATA_7 PIN_D0
#define TESTPIN PIN_F5
#include <string.h>
int DATA;
int COMMAND;
int PAGE;
int i;
int x;
int XPOS;
int KLEIN[11][5];
int GROSS[10][8][2];
int KLEIN_2[10][8][2];
int GROSS_2[11][8][2];
int AUSSCHNITT;
int AUSSCHNITT_INVERS;
int UNITS;
int TENS;
int HUNS;
int THOUS;
long j;
int k;
long n;
int32 VOLLE_PIXEL_L;
int32 VOLLE_PIXEL_H;
#include "Display_Steuerung.h"
#include "Display_Steuerung.c"
void main()
{
Display_Init();
delay_ms(5);
Display_Logo();
for(;;)
{
output_high(TESTPIN);
delay_us(1);
output_low(TESTPIN);
delay_us(1);
}// for(;;)
}//Main()
|
This is my second problem. There are errors when compiling:
Code: |
#pin_select OC2=PIN_D11
#pin_select OC3=PIN_D10
#pin_select OC4=PIN_D9
#pin_select OC5=PIN_D8
#pin_select IC1=PIN_G7
|
*** Error 7 "Testboard_PWM_V01.c" Line 10(12,24): Invalid Pre-Processor directive Invalid Pin
*** Error 7 "Testboard_PWM_V01.c" Line 11(12,24): Invalid Pre-Processor directive Invalid Pin
*** Error 7 "Testboard_PWM_V01.c" Line 12(12,23): Invalid Pre-Processor directive Invalid Pin
*** Error 7 "Testboard_PWM_V01.c" Line 13(12,23): Invalid Pre-Processor directive Invalid Pin
*** Error 7 "Testboard_PWM_V01.c" Line 15(12,23): Invalid Pre-Processor directive Invalid Pin
Last edited by richi-d on Tue Apr 07, 2009 8:23 am; edited 1 time in total |
|
|
richi-d
Joined: 28 Aug 2007 Posts: 106
|
Next Problem: |
Posted: Tue Apr 07, 2009 8:23 am |
|
|
This PIC has 9 input captures and 9 output compares, but it seems CCS supports only 5!!
#pin_select OC8=PIN_D8
*** Error 7 "Testboard_PWM_V01.c" Line 84(12,23): Invalid Pre-Processor directive Invalid Pin ID
Question: is the PCD a BETA compiler? It seems to me as there are a lot of problems!! |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Tue Apr 07, 2009 11:19 am |
|
|
Quote: | Do I have to map the output oins somehow? | No. Depending on the code part not shown in your listing, the said main loop is possibly never executed. Also RF5 may be configured to another I/O function overriding the port function. With Display_xx() functions commented out, pin F5 should toggle.
Quote: | Question: is the PCD a BETA compiler? | Depends on your definition of a BETA compiler. If it excludes a product sold for the full retail price, it isn't. |
|
|
richi-d
Joined: 28 Aug 2007 Posts: 106
|
|
Posted: Tue Apr 07, 2009 2:10 pm |
|
|
The loop is entered as I can debug the code step after step!
In the Display routines are just Pins going High and Low. The pins I declared above. This does also not work!
How can I use all 9 Input captures and output compares? I need them all... |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Tue Apr 07, 2009 2:37 pm |
|
|
As you mentioned 9 output compare functions, it gave me the idea, that you are simply using the wrong chip definition. GA006 actually has only 5 OC functions while GA106 has 9, and both have different SFR addresses for IO ports, so obviously the code can't work. |
|
|
richi-d
Joined: 28 Aug 2007 Posts: 106
|
Thanks! |
Posted: Wed Apr 08, 2009 12:16 pm |
|
|
Hi FvM, this was really helpful! The compiler works good now. I´m really happy. I ´m sorry that I doubt at CCS, but I was searching 2 hours for this little mistake, and I think without your help I would still search!! |
|
|
zhzhou Guest
|
|
Posted: Thu Apr 30, 2009 3:11 pm |
|
|
I'm having a similar problem on the PIC24FJ64GB106. The hardware definitely supports 9 PWM ports, but the compiler is only letting me setup PWM interrupts on 5 of them (OC1 to OC5). It gives me "Invalid Pre-Processor directive" on the lines the contain #int_ocX where X = 6 to 9.
I'm sure that I have the correct device chosen in MPLAB and also the correct include file. In fact, the include file only has definitions for OC1 to OC5, OC6 to OC9 don't seem to exist!
Any idea on how I can access the interrupts for OC6 to OC9? |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Apr 30, 2009 3:40 pm |
|
|
Quote: | Any idea on how I can access the interrupts for OC6 to OC9? | If they have been forgotten in the device configuration, you can't. Report the issue to CCS support. At best, the interrupts are already provided as an option and can be enabled in the Device Editor tool. |
|
|
|