Powered by Invision Power Board


Forum Rules Forum Rules (Please read before posting)
  Reply to this topicStart new topicStart Poll

> Mikroc Problems With Software
Mattyz
Posted: April 05, 2012 01:13 pm
Reply to this postQuote Post


Newbie
**

Group: Members+
Posts: 16
Member No.: 35,624
Joined: August 25, 2011




I've just wrote this code for my project (the 8x8 LED RGB Matrix) but this function seems not to work. I can't recognise the mistake...

CODE
void Serial_Out (char nbytes, unsigned long value)   // nbytes = number of bytes to send; value = number to send
{
    for (unsigned long i=0; i<nbytes*8; i++)   // Repeats nbytes*8 times
    {
        short a;
       
        a = 0!!(value & (1<<(nbytes*8-1)));     // Shifts bit-by-bit (on the PORTB) the value to send
        PORTB.F0 = a;
        PORTB.F1 = 1;                                // Raising edge of the SERIAL CLOCK
        PORTB.F1 = 0;                                // Falling edge of the SERIAL CLOCK -> now the bit has been shifted on the 74HC595 register
    }
       
    PORTB.F2 = 1;                  // Raising edge of the LATCH CLOCK
    PORTB.F2 = 0;                  // Falling edge of the LATCH CLOCK -> now the 74HC595 outputs are "frozen" till the next LATCH CLOCK pulse comes
}


The errors are:


Invalid expression rgb_matrix_lib.h
; expected, but 'unsigned' found rgb_matrix_lib.h
Invalid expression rgb_matrix_lib.h
; expected, but 'long' found rgb_matrix_lib.h
Undeclared identifier 'i' in expression rgb_matrix_lib.h
')' expected, but ';' found rgb_matrix_lib.h
Undeclared identifier 'i' in expression rgb_matrix_lib.h
'}' expected ';' found rgb_matrix_lib.h
; expected, but '.' found rgb_matrix_lib.h
'PORTB' Identifier redefined rgb_matrix_lib.h
Specifier needed rgb_matrix_lib.h
Invalid declarator expected'(' or identifier rgb_matrix_lib.h
Internal error '' rgb_matrix_lib.h

PS: this code belongs to an header (.h) file, which is going to be implement on the main code:

CODE
#include "RGB_Matrix_lib.h"

void main()
{
     ...CODE...
}


Feel free to ask me if I've not been clear. Thanks again for your help

This post has been edited by Mattyz on April 05, 2012 01:16 pm
PMEmail Poster
Top
Gorgon
Posted: April 06, 2012 12:43 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Trusted Members
Posts: 3,008
Member No.: 3,861
Joined: December 18, 2005




You are sure that the code in your header file, should not be in a .c file?

From the error messages you get I would think the precompiler does not like the taste of your .h file.

Definitions, references and prototypes in .h files, and this and code in .c files.

TOK wink.gif


--------------------
Light travels faster than sound. That's why some people appear bright until they speak!
PMEmail Poster
Top
Mattyz
Posted: April 11, 2012 06:19 pm
Reply to this postQuote Post


Newbie
**

Group: Members+
Posts: 16
Member No.: 35,624
Joined: August 25, 2011




I studied better the meaning of .c files, .h files and so on and finally I solved my problem! Thank you for the input,

Matt
PMEmail Poster
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 


:: support us ::




ElectronicsSkin by DutchDork & The-Force