|
|
View previous topic :: View next topic |
Author |
Message |
pilar
Joined: 30 Jan 2008 Posts: 197
|
Doubts with MAKE32 |
Posted: Tue Feb 01, 2011 4:26 pm |
|
|
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
|
|
Posted: Tue Feb 01, 2011 4:35 pm |
|
|
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
|
|
Posted: Tue Feb 01, 2011 4:48 pm |
|
|
I was using the Proteus in debug mode, mmm... but when I use the
printf() if I get the desired value, it appears that
Proteus is the problem ...thank you... |
|
|
ze.vana
Joined: 11 Jun 2011 Posts: 15
|
|
Posted: Sat Sep 03, 2011 3:00 pm |
|
|
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);
}
} |
|
|
|
|
|
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
|