Send hexadecimal commands on com1 to turn a light bulb on

Asked By 0 points N/A Posted on -
qa-featured

Hi,

We will be having an experimental presentations on our electronics class and i wanted to use the computer to send hexadecimal commands on com 1 to turn a light bulb on. Could somebody help me what commands should i input?

SHARE
Answered By 0 points N/A #170570

Send hexadecimal commands on com1 to turn a light bulb on

qa-featured

Hello

To be able to help you with that I need to ask you some thinks:

What are you using as components?

Are you using only the computer to do that, or an interfacing electronic card?

Pic interfacing electronic card, what Pic/µc reference, the connections…

With those details I can have a good view of your problem and will help me and others to can have a solution for what you need to know.

Here a small program what you can use, it may help in your electronic project:

#include "pathproject.h"
#use delay(clock=20000000)
#int_RDA
char key=' ';
RDA_isr()
{
   key=getc();
   if(key=='1'){output_bit(PIN_a2,1);}
   if(key=='0'){output_bit(PIN_a2,0);}
   delay_ms(100);
}
void main()
{
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   enable_interrupts(INT_RDA);
   enable_interrupts(GLOBAL);
   setup_oscillator(False);
   // TODO: USER CODE!!
   output_bit(pin_a2,0);
   while(1)
   {
   }
}

Login/Register to Answer

Related Questions