عندي مشكلة في تحويل هذا الكود الى الهكس ديسيمال
رجو منكم المساعدة في حل هدي المشكلة
/************************************************** ****************************\
P R E P R O C E S S O R D I R E C T I V E S
\************************************************* *****************************/
#include <16F877A.h> // This is the type of PIC you're using.
#device *=16 ADC=10 // Use 16-bit pointers, use 10-bit ADC
#include "Include\Compiler.h" //include files for other stuff
#include "Include\Globals.h"
#include "Include\Misc.c"
#include "Include\string.h"
#fuses HS // You may or may not want some of these ....
#fuses NOWDT
#fuses NOPROTECT
//#fuses NOLVP
//#fuses NODEBUG
//#fuses NOPUT
//#fuses NOBROWNOUT
#use delay(clock=16000000) // Speed of clock
// These require use of Set_Tris_x()
#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
#use fast_io(D)
#use rs232(baud=9600, xmit=TX_DATA, rcv=RX_DATA) // baud rate has to do with frequency
#define serial_out
// End Preprocessor Directives
/************************************************** ****************************\
M A I N R O U T I N E (RX)
\************************************************* *****************************/
#pragma zero_ram // Interesting command ....
void main( void){
disable_interrupts(GLOBAL); // We don't want to be interrupted yet
delay_ms(500); // wait for voltages to stablize
status = 'P';
warning = 'W';
Set_Tris_A(MY_TRISA); // Port A's I/O
Set_Tris_C(MY_TRISC); // Port C's I/O
Set_Tris_D(MY_TRISD); // Port D's I/O
output_low(ALARM1);
18
output_low(CLOCK1);
output_low(LEDS_BAD);
output_high(LEDS_GOOD);
initTimers(); // This is where the interrupts are enabled again
delay_ms(500);
//initADC();
//get the XBEE module ready to receive data
delay_ms(400); //delays allow the UART data line to remain high (1)
while(!kbhit()){
status = getc();
if(warning == status){
output_high(ALARM1);
output_high(CLOCK1);
output_low(LEDS_GOOD);
while(FOREVER){
output_high(LEDS_BAD);
delay_ms(500);
output_low(LEDS_BAD);
delay_ms(500);
}
}
}
// output_high(ALARM1);
// output_high(CLOCK1);
}
// End Main Routine
/************************************************** ****************************\
M A I N R O U T I N E (TX)
\************************************************* *****************************/
#pragma zero_ram // Interesting command ....
void main( void)
{
disable_interrupts(GLOBAL); // We don't want to be interrupted yet
delay_ms(1000); // wait for voltages to stablize
Set_Tris_A(MY_TRISA); // Port A's I/O
Set_Tris_C(MY_TRISC); // Port C's I/O
Set_Tris_D(MY_TRISD); // Port D's I/O
output_low(XB_SLEEP);
output_high(ALARM1);
//initTimers(); // This is where the interrupts are enabled again
delay_ms(500);
//initADC();
//get the XBEE module ready to receive data
delay_ms(400); //delays allow the UART data line to remain high (1)
//because all highs means no transmit
while(FOREVER){
for(i=0;i<10;i++){ //poll the warning information 10 times
putc('W');
delay_ms(400);
}
gotosleep();
delay_ms(27000);
wakeup();
}
}
// End Main Routine