
 Originally Posted by 
red_horse
					
				 
				Dili maka tag-an ana bro since wala man ka gapakita sa imo codes or circuit.
But there are ways to debug both your hardware and software.
Let us start sa hardware.
First do an echo test sa PC side.
I assume gagamit ka ug ug max232/max3232.
I-short ang pin11 and pin12 or pin9 and pin10 sa max232/max3232 depende ug asa nimo gi-connect ang USB-to-serial cable.
Open up USART terminal sa mikroC or sa windows (hyperterminal).
Make sure the same ang baud rate settings and tsakto sad ang comport.
Send a character sa terminal. If di nimo ma receive ang imo gi send sa terminal, that means may problem imo hardware.
			
		 
	 
 Mao ni ako naa sa Proteus circuit Bro @red_horse 
naa ko pangutana unsa nang COMPIM dba mao nang DB9 or USB-to-RS232?
Mao ni Code nako sa MikroC Pro.
	Code:
	char UART1_Data_Ready();
char uart_rd;
void main()
{
  TRISB=0;
  PORTB=0;
  UART1_Init(9600);               // Initialize UART module at 9600 bps
  Delay_ms(100);                  // Wait for UART module to stabilize
  while(1)
  {
           if(UART1_Data_Ready())
           {
            while(1)
            {
              uart_rd = UART1_Read();
              if(uart_rd=='A')
              {
               PORTB=0X14;
               DELAY_ms(5000);
               PORTB=0X24;
               DELAY_ms(500);
               PORTB=0X41;
               DELAY_ms(5000);
               PORTB=0X42;
               DELAY_ms(500);
              }
              else if(uart_rd=='O')
              {
                 PORTB=0x00;
                 DELAY_ms(500);
              }
              else if(uart_rd=='m')
              {
                 PORTB=0x41;
                 DELAY_ms(500);
              }
              else if(uart_rd=='M')
              {
                 PORTB=0x14;
                 DELAY_ms(500);
              }
            }
           }
  }
  }
 Kini mao ni ako code sa Visual C#.....
	Code:
	using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
namespace SerialPortsNew
{
    public partial class Form1 : Form
    {
        SerialPort port = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One);
        bool CurrentState = true;
        bool PrevState;
        public Form1()
        {
            InitializeComponent();
        }
        private void Automatic_Click(object sender, EventArgs e)
        {
            Manual.Enabled = false;
            off.Enabled = true;
            port.Open();
            port.Write("A");
            port.Close();
        }
        private void Manual_Click(object sender, EventArgs e)
        {
            Manual.Visible = false;
            off.Enabled = true;
            Automatic.Enabled = false;
            pressManual.Visible = true;
        }
        private void off_Click(object sender, EventArgs e)
        {
            if (CurrentState)
            {
                Manual.Enabled = true;
                Automatic.Enabled = true;
                Manual.Visible = true;
                pressManual.Visible = false;
                port.Open();
                port.Write("O");
                port.Close();
                PrevState = false;
                CurrentState = PrevState;
            }
            else if (PrevState == false && CurrentState == PrevState)
            {
                Manual.Visible = true;
                pressManual.Visible = false;
                Automatic.Enabled = true;
                port.Open();
                port.Write("O");
                port.Close();
                CurrentState = true;
            }
        }
        private void pressManual_Click(object sender, EventArgs e)
        {
            if (CurrentState)
            {
                port.Open();
                port.Write("M");
                port.Close();
                PrevState = false;
                CurrentState = PrevState;
            }
            else if (PrevState == false && CurrentState == PrevState)
            {
                port.Open();
                port.Write("m");
                port.Close();
                CurrentState = true;
            }
        }
    }
}
 ahak ani oi deadline nabaya inig Friday..