Pages: [1]   Go Down
Author Topic: Error: invalid suffix "p89" on integer constant  (Read 2416 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 97
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What does that error mean?  Google has been no help at all. 

Backstory to this is I modified the pins_arduino.c file to include more of the I/O pins on the ATMEGA 328, and I made a test code and it worked, and now I am trying to update my main code to use all the pins and this keeps appearing.

On the Atmega, I've been following this pinmap: http://www.arduino.cc/en/Hacking/PinMapping168
and am using pins 9 and 10 (the crystal pins) as two digital outputs.  Also, the analogue pins 0-4 are being used as digital inputs.

In my test code, I go straight to pinMode() and set all the pins (0-21) as digital outputs.  Then I test a blink sketch, and all the pins work as that. In my main code, I start with const int and try and name the pins (here):

Quote
const int button1 = A0;
const int button2 = A1;
const int button3 = A2;
const int button4 = A3;
const int button5 = A4;
const int buttonm = 13; //Set the Button Pins
const int red1 = 0;
const int green1 = 1;
const int blue1 = 2;
const int red2 = 3;
const int green2 = 4;
const int blue2 = 20;
const int red3 = 21;
const int green3 = 5;
const int blue3 = 6;
const int red4 = 7;
const int green4 = 8;
const int blue4 = 9;
const int red5 = 10;
const int green5 = 11;
const int blue5 = 12; //Set the LED Pins

For the buttons, I've tried to use 14-18 instead of A0-A4 as well, same error.  Here is what my test code starts with:

Quote
void setup() {               
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(14, OUTPUT);
pinMode(15, OUTPUT);
pinMode(16, OUTPUT);
pinMode(17, OUTPUT);
pinMode(18, OUTPUT);
pinMode(19, OUTPUT);
pinMode(20, OUTPUT);
pinMode(21, OUTPUT);
}

And that allows all 22 pins to be used as digital outputs.

Any idea whats happening here?
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 547
Posts: 45996
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What does that error mean?  Google has been no help at all. 
You'll need to post all of your code, and the complete output. What board are you compiling for?

Quote
Backstory to this is I modified the pins_arduino.c file to include more of the I/O pins on the ATMEGA 328
Modified how?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 97
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is how I modified it to use the extra pins: http://arduino.cc/forum/index.php/topic,71572.0.html

Here is my original code, this works.

Quote
/* Techno gloves!  Here is some code for techno gloves with individual
finger control.  Written in July 2011 by Kevin Venalainen and Bryan Hellard*/

// Set the Constants:
const int button1 = 10;
const int button2 = 6;
const int button3 = 2;
const int buttonm = A1; //Set the Button Pins
const int red1 = 13;
const int green1 = 12;
const int blue1 = 11;
const int red2 = 9;
const int green2 = 8;
const int blue2 = 7;
const int red3 = 5;
const int green3 = 4;
const int blue3 = 3; //Set the LED Pins

//Set the Variables:
int buttonPushCounterm = 0; //Main button counter
int buttonStatem = 0; //Main button state
int lastButtonStatem = 0; // Last main buton state
int buttonPushCounter1 = 0;
int buttonState1 = 0;
int lastButtonState1 = 0;
int buttonPushCounter2 = 0;
int buttonState2 = 0;
int lastButtonState2 = 0;
int buttonPushCounter3 = 0;
int buttonState3 = 0;
int lastButtonState3 = 0; //And set the rest (1, 2, 3)

void setup() {
 pinMode(button1, INPUT);
 pinMode(button2, INPUT);
 pinMode(button3, INPUT);
 pinMode(buttonm, INPUT); //Buttons are inputting info
 pinMode(blue1, OUTPUT);
 pinMode(green1, OUTPUT);
 pinMode(red1, OUTPUT);
 pinMode(blue2, OUTPUT);
 pinMode(green2, OUTPUT);
 pinMode(red2, OUTPUT);
 pinMode(blue3, OUTPUT);
 pinMode(green3, OUTPUT);
 pinMode(red3, OUTPUT); // LEDS are Outputs

 Serial.begin(9600);} //Initialize serial communication.

void allblue(){
 digitalWrite(blue1, HIGH);
 digitalWrite(blue2, HIGH);
 digitalWrite(blue3, HIGH);
 allredoff();
 allgreenoff();} //Function for Blue

void allblueoff(){
 digitalWrite(blue1, LOW);
 digitalWrite(blue2, LOW);
 digitalWrite(blue3, LOW);}  // Blue off

void allred(){
 digitalWrite(red1, HIGH);
 digitalWrite(red2, HIGH);
 digitalWrite(red3, HIGH);
 allblueoff();
 allgreenoff();} //Fuction for Red

void allredoff(){
 digitalWrite(red1, LOW);
 digitalWrite(red2, LOW);
 digitalWrite(red3, LOW);} // Red Off

void allgreen(){
 digitalWrite(green1, HIGH);
 digitalWrite(green2, HIGH);
 digitalWrite(green3, HIGH);
 allredoff();
 allredoff();} //Function for Green

void allgreenoff(){
 digitalWrite(green1, LOW);
 digitalWrite(green2, LOW);
 digitalWrite(green3, LOW);} //Green off

void alloff(){
 allgreenoff();
 allredoff();
 allblueoff();} // All off

void loop() {
 buttonStatem = digitalRead(buttonm); //Read the Main button

 if (buttonStatem > lastButtonStatem) { //Compare it to its last state
   buttonPushCounterm++; //Add one to the counter
     if (buttonPushCounterm == 9) {
       buttonPushCounterm = 1;} //If the counter reaches 9, reset back to 1
     Serial.println("on");
     Serial.print("number of button pushes:  ");
     Serial.println(buttonPushCounterm, DEC);} //Print what number
the counter is on

 lastButtonStatem = buttonStatem; //Save the button state for next time looping

 if (buttonPushCounterm == 1) {
    alloff();
    allgreen();} //What to do if the counter is 1

 if (buttonPushCounterm == 2) {
   alloff();
   allgreen();
   delay(6);
   allgreenoff();
   delay(1);
   allblue();
   delay(6);
   allblueoff();
   delay(1);} // If its 2

 if (buttonPushCounterm == 3){
   alloff();
   allblue();} // 3

 if (buttonPushCounterm == 4){
   alloff();
   allblue();
   delay(6);
   allblueoff();
   delay(1);
   allred();
   delay(6);
   allredoff();
   delay(1);} // 4

 if (buttonPushCounterm == 5){
   alloff();
   allred();} // 5

 if (buttonPushCounterm == 6){
   alloff();
   allgreen();
   delay(6);
   allgreenoff();
   delay(1);
   allred();
   delay(6);
   allredoff();
   delay(1);}  // 6

 if (buttonPushCounterm == 7){
   alloff();
   allgreen();
   delay(8);
   allgreenoff();
   allblue();
   delay(8);
   allblueoff();
   allred();
   delay(8p89);
   allredoff();} // 7

 if (buttonPushCounterm == 8){
   alloff(); //Turn all the LEDS off

       buttonState3 = digitalRead(button3);
       buttonState2 = digitalRead(button2);
       buttonState1 = digitalRead(button1); // Read the 3 buttons

       if (buttonState3 > lastButtonState3){ //Compare button 3

       buttonPushCounter3++; // Add 1 to the counter
       if (buttonPushCounter3 == 8) {
       buttonPushCounter3 = 1;} // If the counter reaches 4, reset to 1
       Serial.println("on");
       Serial.print("Button 3 number of presses: ");
       Serial.println(buttonPushCounter3, DEC);} // Serial print what number
the counter is on

       lastButtonState3 = buttonState3; // Save the State for next time

       if (buttonPushCounter3 == 0){
               alloff();} // Start all off

       if (buttonPushCounter3 == 1){
               digitalWrite(green3, LOW);
               digitalWrite(red3, HIGH);} // Red

       if (buttonPushCounter3 == 2){
               digitalWrite(red3, HIGH);
               digitalWrite(blue3, HIGH);} // Purple

       if (buttonPushCounter3 == 3){
          digitalWrite(blue3, HIGH);
          digitalWrite(red3, LOW);} // Blue

       if (buttonPushCounter3 == 4){
         digitalWrite(blue3, HIGH);
         digitalWrite(green3, HIGH);} // Teal

       if (buttonPushCounter3 == 5){
         digitalWrite(blue3, LOW);
         digitalWrite(green3, HIGH);} // Green

       if (buttonPushCounter3 == 6){
         digitalWrite(green3, HIGH);
         digitalWrite(red3, HIGH);} // Yellow

       if (buttonPushCounter3 == 7){
         digitalWrite(green3, HIGH);
         digitalWrite(blue3, HIGH);
         digitalWrite(red3, HIGH);} //Strobe

       if (buttonState2 > lastButtonState2){ // Compare Button 2

               buttonPushCounter2++;
               if (buttonPushCounter2 == 8) {
                       buttonPushCounter2 = 1;} // Add to the counter
               Serial.println("on");
               Serial.print("Button 2 number of presses: ");
               Serial.println(buttonPushCounter2, DEC);} // Serial print the number

       lastButtonState2 = buttonState2; // Save it for next time

       if (buttonPushCounter1 == 0){
               alloff();} // Start all off

       if (buttonPushCounter2 == 1){
               digitalWrite(green2, LOW);
               digitalWrite(red2, HIGH);} // Red

       if (buttonPushCounter2 == 2){
               digitalWrite(red2, HIGH);
               digitalWrite(blue2, HIGH);} // Purple

       if (buttonPushCounter2 == 3){
          digitalWrite(blue2, HIGH);
          digitalWrite(red2, LOW);} // Blue

       if (buttonPushCounter2 == 4){
         digitalWrite(blue2, HIGH);
         digitalWrite(green2, HIGH);} // Teal

       if (buttonPushCounter2 == 5){
         digitalWrite(blue2, LOW);
         digitalWrite(green2, HIGH);} // Green

       if (buttonPushCounter2 == 6){
         digitalWrite(green2, HIGH);
         digitalWrite(red2, HIGH);} // Yellow

       if (buttonPushCounter2 == 7){
         digitalWrite(green2, HIGH);
         digitalWrite(blue2, HIGH);
         digitalWrite(red2, HIGH);} //Strobe


       if (buttonState1 > lastButtonState1){ //Compare button 1

               buttonPushCounter1++; // Add to the counter
               if (buttonPushCounter1 == 8) {
                       buttonPushCounter1 = 1;} // Reset when it reaches max
               Serial.println("on");
               Serial.print("Button 1 number of presses: ");
               Serial.println(buttonPushCounter1, DEC);} // Print the number

       lastButtonState1 = buttonState1; // Save for next time

       if (buttonPushCounter1 == 0){
               alloff();} // Start all off

       if (buttonPushCounter1 == 1){
               digitalWrite(green1, LOW);
               digitalWrite(red1, HIGH);} // Red

       if (buttonPushCounter1 == 2){
               digitalWrite(red1, HIGH);
               digitalWrite(blue1, HIGH);} // Purple

       if (buttonPushCounter1 == 3){
          digitalWrite(blue1, HIGH);
          digitalWrite(red1, LOW);} // Blue

       if (buttonPushCounter1 == 4){
         digitalWrite(blue1, HIGH);
         digitalWrite(green1, HIGH);} // Teal

       if (buttonPushCounter1 == 5){
         digitalWrite(blue1, LOW);
         digitalWrite(green1, HIGH);} // Green

       if (buttonPushCounter1 == 6){
         digitalWrite(green1, HIGH);
         digitalWrite(red1, HIGH);} // Yellow

       if (buttonPushCounter1 == 7){
         digitalWrite(green1, HIGH);
         digitalWrite(blue1, HIGH);
         digitalWrite(red1, HIGH);} // White


 } //End of what to do if Main button Counter = 8
} // End of program
« Last Edit: September 14, 2011, 04:53:54 pm by Xyver » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 97
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

And here is the code that I made to test that all the pins worked on the ATMEGA 328.

Quote
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */

void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(14, OUTPUT);
pinMode(15, OUTPUT);
pinMode(16, OUTPUT);
pinMode(17, OUTPUT);
pinMode(18, OUTPUT);
pinMode(19, OUTPUT);
pinMode(20, OUTPUT);
pinMode(21, OUTPUT);
}

void loop() {
  digitalWrite(0, HIGH);   // set the LED on
  digitalWrite(1, HIGH);
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, HIGH);
  digitalWrite(10, HIGH);
  digitalWrite(11, HIGH);
  digitalWrite(12, HIGH);
  digitalWrite(13, HIGH);
  digitalWrite(14, HIGH);
  digitalWrite(15, HIGH);
  digitalWrite(16, HIGH);
  digitalWrite(17, HIGH);
  digitalWrite(18, HIGH);
  digitalWrite(19, HIGH);
  digitalWrite(20, HIGH);
  digitalWrite(21, HIGH);
  delay(100);              // wait for a second
  digitalWrite(0, LOW);    // set the LED off
  digitalWrite(1, LOW);
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW);
  digitalWrite(12, LOW);
  digitalWrite(13, LOW);
  digitalWrite(14, LOW);
  digitalWrite(15, LOW);
  digitalWrite(16, LOW);
  digitalWrite(17, LOW);
  digitalWrite(18, LOW);
  digitalWrite(19, LOW);
  digitalWrite(20, LOW);
  digitalWrite(21, LOW);
  delay(100);              // wait for a second
}

This works as well, any pin I choose does the blink on the ATMEGA 328.  There is the 22 pins I need.

And here is how I started modifying my original code.  I wont repost the whole thing, because it screws us as soon as I change the beginning.  Heres how it starts:

Quote
// Set the Constants:
const int button1 = 14;
const int button2 = 15;
const int button3 = 16;
const int button4 = 17;
const int button5 = 18;
const int buttonm = 13; //Set the Button Pins
const int red1 = 0;
const int green1 = 1;
const int blue1 = 2;
const int red2 = 3;
const int green2 = 4;
const int blue2 = 20;
const int red3 = 21;
const int green3 = 5;
const int blue3 = 6;
const int red4 = 7;
const int green4 = 8;
const int blue4 = 9;
const int red5 = 10;
const int green5 = 11;
const int blue5 = 12;//Set the LED Pins

Anything else you'd like me to post?  I used the Arduino as an ISP to program the ATMEGA 328, and there was plenty of problems there, but that got all worked out (here: http://arduino.cc/forum/index.php/topic,70199.0.html and here: http://arduino.cc/forum/index.php/topic,71572.0.html) so now its just this programming problem that has appeared.

EDIT:: Here is the complete error message:
testing_full_code.cpp:184:10: error: invalid suffix "p89" on integer constant
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 547
Posts: 45996
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Here is my original code, this works.

 if (buttonPushCounterm == smiley-cool{
Hard to believe that this works.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 97
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

smiley-cool = 8 ) without the space... I'll disable smilies on the previous posts.  Or is there another reason why it wouldnt work?
Logged

Germany
Offline Offline
Edison Member
*
Karma: 100
Posts: 1222
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

inside
Code:
delay(8p89);
the number 8p89 is not valid. C/C++ allows suffixes like 8UL to mark a number as unsigned long, but p89 is "not a valid suffix"  smiley-wink

Oliver
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 97
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow.... Fancy that.  Thank you!  I looked through that so many times..... Can't believe i missed that xD
Logged

0
Online Online
Shannon Member
****
Karma: 159
Posts: 10415
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Surely the compiler error message had a line number in it to help you find it?
Logged

[ I won't respond to messages, use the forum please ]

Pages: [1]   Go Up
Jump to: