السلام عليكم اخوانى
والله انا عارف انى بتثقل عليكم وخصوصا المهندس ريان والاستاذ ربوتا بس معلش استحملونى انا بجد اسف ليكم
انا اريد التاكد من ان مشروعى شغال لانى عندما اشغل السيملشون الى رسمه لى الاستاذ الفاضل ريان بيشتغل تمام بس المشكلة عندما ارسل من السى شارب امر يشغل الليدات الموجودة على السيملشون مش بيشتغل مع العلم انى كتبت برنامج فى الميكرو سى و كود السى شارب مع العلم انى جربت البرنامج الى بعته لى الاستاذ روبوتا وهو virtual port ولم يشتغل ايضا برجاء مساعدتى اخوانى
هذا كود الميكروسى
char text[8];
char x,i;
void main()
{
trisb=0;
portb=0;
UART1_Init(9600);
i=0;
while(1){
if(UART1_Data_Ready()){
text[i]= UART1_Read();
i++;
if(i==8){
i=0;
for(x=0;x<8;x++)
{
portb.f0=text[x];
portb.f1=0;portb.f1=1;
}
portb.f2=0;portb.f2=1;}
}
}
}
|
وهذا اخوانى مود السى شارب
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 The_control
{
public partial class Master : Form
{
SerialPort port;
public Master()
{
InitializeComponent();
string[] ports = SerialPort.GetPortNames();
foreach (string port1 in ports)
{
coms.Items.Add(port1);
}
}
public String convBoolToString(bool[] a)
{
string s = null;
foreach (bool l in a)
{
if (l == true) { s = 1 + s; }
else s = 0 + s;
}
return s;
}
private void button2_Click(object sender, EventArgs e)
{
button1.Enabled = true;
c.Enabled = true;
button2.Enabled = false;
try
{
port = new SerialPort(coms.Text, 9600, Parity.None, 8, StopBits.One);
}
catch (Exception)
{
System.Windows.Forms.DialogResult answer;
{
answer = MessageBox.Show("You Don't Select Com-Port ? ", "Exit", MessageBoxButtons.OK, MessageBoxIcon.Question);
if (answer == System.Windows.Forms.DialogResult.OK)
{
Application.Exit();
}
}
}
if (port.IsOpen) port.Close();
try
{
port.Open();
}
catch (System.Exception ex)
{
if (port.IsOpen) port.Close();
}
}
private void button1_Click_1(object sender, EventArgs e)
{
int i;
bool[] m = new bool[8];
for (i = 0; i < c.Items.Count; i++)
{
m[i] = c.GetItemChecked(i);
}
MessageBox.Show(convBoolToString(m),"Ahmed Messages");
port.Write(convBoolToString(m));
}
}
}
|
وهذا الملف موجود به كل المشروع+السيلشون وكل شى عن مشروعى
برجاء مساعدتى وتصحيح الاخطاء ان وجدت وجزاكم الله كل خير ربنا يبارك فيكم