Two times development of laser laser EZLAZE3

Source: Internet
Author: User




Communication: RS232 Interface


command Syntax< prefix >< address >< command string >< parameters >< Terminator >

field

description

prefix

a semicolon character"; " (59), must be placed in front of all commands, when the device receives the prefix character will reset the command input buffer.

address

two

command string

commands are  Specific to each device  -- see the following sections for  the commands that each device supports.

parameters

some commands may have parameters which immediately  follow the command string. multiple parameters are separated by  commas (comma).  you must supply the correct number of characters  for all parameters under all circumstances. for example, if  a command expects a three-digit value, then the parameter  must in the form  ", " 001 "... "  etc.

Terminator

The ASCII carriage return character (13), which accepts that the device does not process any commands when the terminal does not receive a terminator.


Basic command:

  • Energy laat### 000-255
  • Frequency larr### 000-255
  • Excitation mode; lamo# 0 Continuous 1 single gun 2 burst
  • Laser light brightness ; lasp### 000-255 is flashing; lasb# 0 does not flash 1 flashing flash frequency; labr### 000-255
  • Wavelength selection ir high and low; lahs# 1 Low 2 high green height ; lahs# 3 Low 5 high
  • Number of outbreaks; labu#### 0000-0050
  • Shape (SLITX, slity): ; laxs###; lays### 000-255
  • High Energy; LAENH Energy is low; Laenl
  • Laser shot ; LAGO
  • Stop shooting ; Last
  • Turn on the laser; LAON
  • Turn off the laser; Laof
  • Count ; LASC statistic laser to the current time how many times it has been fired
Control Process Initializing the Laser

Open serial port

send "; LASM1 "&NBSP;

 send "; LASS "  Check the safety status of linkage device and motor, wait for the motor moving bit to be cleared 0

  If the safety interlock device is reliable,  send  "; LAON "To set the laser to standby mode.

Keep Communication
when the laser is opened ( sent "; LAON "command" must be timed (at least two seconds) to send the command to the laser, otherwise the laser will automatically shut down. Used "; LASS "To set the time to check the laser status.
   launch Laser

Set the laser's energy, frequency, excitation mode, wavelength, aperture

Send "; LAGO "emitting laser

Send "; Last "stop firing laser

Send ": laof" to set the laser to stop mode

Program Implementation

1) Open the serial portThe serial port communication calls is open source RS232 control Source Rs232.h and RS232.C, it provides the functionint rs232_opencomport (int comport_number, int baudrate, const char *mode)can be used to open a specified serial port, three parameters representing the string number, baud rate, communication protocol. Use Set baudrate=9600,char mode[]={' 8 ', ' N ', ' 1 ', 0} when the function returns 0 indicates that the serial port has been successfully opened 2) Send information to the serial port
void rs232_cputs (int comport_number, const char *text)/* sends a string to serial port */ { wh Ile (*text! = 0) Rs232_sendbyte (comport_number, * (text++)); }
Calling method: Rs232_cputs (Cport_nr, ";   Lass\n "); Send "; lass\n "//Check safety interlock status3) Fixed time check laser status
use multithreaded programming to create a new thread for the query event. #include <pthread.h>
int res;
pthread_t A_thread,b_thread;
res = pthread_create (&a_thread, null,thread_function,null);
if (res!=0)
{
printf ("Create pthread error!/n");
return 1;     }
Interactive interface

Using QT to write GUI interfaces























Two times development of laser laser EZLAZE3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.