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 CCS Technical Support

Doubts with MAKE32

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



Joined: 30 Jan 2008
Posts: 197

View user's profile Send private message

Doubts with MAKE32
PostPosted: Tue Feb 01, 2011 4:26 pm     Reply with quote

Hi, I'm trying to use the make32() to combine 4 bytes data but I did it,
applying make32 the 4 bytes as a result I have 0x1781 and not as it should be 0x04D21781.

Somebody could say which is my mistake?

here my code:
Code:
#include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT
#use delay(clock=20MHz)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)// RS232 Estándar

int32 Pagina;

void main(){

      Pagina = make32(0X04, 0XD2, 0X17, 0X81);
             
while (TRUE);
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Feb 01, 2011 4:35 pm     Reply with quote

Quote:
as a result I have 0x1781

How do you know this ? I don't see any code to display the result.
pilar



Joined: 30 Jan 2008
Posts: 197

View user's profile Send private message

PostPosted: Tue Feb 01, 2011 4:48 pm     Reply with quote

I was using the Proteus in debug mode, mmm... but when I use the
printf() if I get the desired value, Evil or Very Mad it appears that
Proteus is the problem ...thank you...
ze.vana



Joined: 11 Jun 2011
Posts: 15

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

PostPosted: Sat Sep 03, 2011 3:00 pm     Reply with quote

PCM programmer wrote:
Quote:
as a result I have 0x1781

How do you know this ? I don't see any code to display the result.

Look at this:
I modified your code and tested in on proteus, it's working, it shows:
(pagina:80877441) , is it you want?
Code:

#include <16F877a.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT
#use delay(clock=20MHz)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)// RS232 Estándar

int32 Pagina;

void main(){

      Pagina = make32(0X04, 0XD2, 0X17, 0X81);
             
while (TRUE)
{
 printf("pagina:%LU \r\n",pagina );
 delay_ms(100);
 }
 }
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