EgrK
Junior Member level 2
- Joined
- Jul 31, 2012
- Messages
- 24
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,283
- Location
- East part of world
- Activity points
- 1,438
hellow
i want to send the string y23 followed by newline (CR then LF) this is done by file.asm then read that string by c# program (file2.cs )
those are my two program
i could see very long string in the messageBox and it becomes longer and longer
need your help
i want to send the string y23 followed by newline (CR then LF) this is done by file.asm then read that string by c# program (file2.cs )
those are my two program
Code:
loop movlw 0x79
call snd
movlw 2
call snd
movlw 3
call snd
movlw 0x0D ;CR
call snd ;Send CR
movlw 0x0A ;LF
call snd ;Send LF
goto loop
Code:
and this is the c# program
using System;
using System.Collections;//.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using System.Threading;
namespace graphic1
{
public partial class Form1 : Form
{ SerialPort sp = new SerialPort();
int i,j;
string str;
public Form1()
{ InitializeComponent();
sp.PortName = "com1";
sp.BaudRate = 115200; // 9600;
sp.DataBits = 8;
sp.Parity = Parity.None;
sp.StopBits = StopBits.One;
sp.Handshake = Handshake.None;
sp.ReadTimeout = 15000;
sp.WriteTimeout = 15000;
sp.DataReceived += serialPort_DataReceived;
sp.Open();
}
//
void serialPort_DataReceived(object s, SerialDataReceivedEventArgs e)
{
byte[] data = new byte[sp.BytesToRead];
sp.Read(data, 0, data.Length);
//MessageBox.Show(data.ToString());
str=ByteArrayToString2(data);
MessageBox.Show(str);
}
}
}
need your help
Last edited: