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 support@ccsinfo.com

simple macro problem

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



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

simple macro problem
PostPosted: Fri Oct 15, 2004 10:03 am     Reply with quote

#define USBN_RST USBN_BUS = 5

void main(void)
{
USBN_RST; <---Error: A numeric expression must appear here
}
_________________
Alex
dvsoft



Joined: 28 Nov 2003
Posts: 46

View user's profile Send private message

PostPosted: Fri Oct 15, 2004 10:37 am     Reply with quote

bonsoir

juste write
#define USBN_RST USBN_BUS 5

when you use USBN_RST USBN_BUS in expression the compiler replace by 5

Alain
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Oct 15, 2004 11:06 am     Reply with quote

Did you declare USBN_BUS?
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

PostPosted: Mon Oct 18, 2004 4:00 am     Reply with quote

Mark wrote:
Did you declare USBN_BUS?


#define USBN_BUS PORTC;
_________________
Alex
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Oct 18, 2004 6:40 am     Reply with quote

Okay, did you declare PORTC?

Code:
CCS PCM C Compiler, Version 3.206, 22485               18-Oct-04 08:40

               Filename: test.LST

               ROM used: 17 words (0%)
                         Largest free fragment is 2048
               RAM used: 5 (3%) at main() level
                         5 (3%) worst case
               Stack:    0 locations

*
0000:  MOVLW  00
0001:  MOVWF  0A
0002:  GOTO   004
0003:  NOP
....................  #include <16F877.H> 
....................  //////// Standard Header file for the PIC16F877 device //////////////// 
.................... #device PIC16F877 
.................... #list 
.................... 
.................... #fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP   
.................... #use delay(clock = 4000000)   
....................   
.................... #byte PORTC = 0x07 
.................... #define USBN_BUS PORTC 
.................... #define USBN_RST USBN_BUS = 5 
.................... void main()   
.................... {   
0004:  CLRF   04
0005:  MOVLW  1F
0006:  ANDWF  03,F
0007:  BSF    03.5
0008:  BSF    1F.0
0009:  BSF    1F.1
000A:  BSF    1F.2
000B:  BCF    1F.3
....................   
.................... USBN_RST; 
000C:  MOVLW  05
000D:  BCF    03.5
000E:  MOVWF  07
.................... while(TRUE)   
....................  {   
....................  }   
000F:  GOTO   00F
.................... }   
.................... 
0010:  SLEEP

Configuration Fuses:
   Word  1: 3F71   XT NOWDT PUT NOPROTECT BROWNOUT NOLVP NOCPD NOWRT NODEBUG
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

PostPosted: Mon Oct 18, 2004 6:42 am     Reply with quote

Yes, it is declared in the header file, I ve checked that
_________________
Alex
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Oct 18, 2004 6:46 am     Reply with quote

Well as everyone can clearly see, it works per my sample posted so you must be giving out misinformation. post a small simple but complete program that demonstrates the problem and maybe we can tell you what is wrong.
alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

PostPosted: Mon Oct 18, 2004 6:59 am     Reply with quote

It is working now,
that is the way I ve eventually done it:

#include "SFR.h"
#define USBN_BUS PORTC
#define USBN_MCNTRL_ADDR 0x05
#define NUMBER 3

#define USBN_RST PORTC = N_MCNTRL_ADDR;\
bit_set(PORTC,NUMBER)

void main(void)
{
USBN_RST;
}

Thank you very much for your help !
_________________
Alex
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