Wish
DX  » Community » Forums
«See all threads (in Electronics)
Electronics

Help with testing an infrared temperature sensor

  • Yogalin Friday, January 12, 2018 3:11 PM Reply

    Hello, I am testing infrared temperature sensor. It is connected to SP485(converter RS485 to RS232?) which is connected to ZYNQ,FPGA.

    hmCPy.png

    I have to input High when I send Tx. After all of messages was sent, I will input Low to this Enable pin.

    Simple approach is to do with one bit width GPIO. Make High just before Write(). After Write() is finished, make GPIO LOW. I thought..it will be work. but it wasn't. Code is like as below...(I use libmodbus library to communicate using rs485)

    CODE
        write(fd,"1",1); // make gpio(enable pin) high.
        req_length = modbus_send_raw_request(ctx, raw_req, 6 * sizeof(uint8_t)); //write
        write(fd,"0",1);//After write(), make gpio low to receive messages from sensor.
        int response_length = modbus_receive_confirmation(ctx, rsp);


    This code was not working properly. Write() is not write immediately.. or the prosess is working independently.(so there is possibility that when I input Low, write() is not finished).

    I don't know reason actually. it's just my assuming.

    So I added usleep();

    CODE
        write(fd,"1",1); // make gpio(enable pin) high.
        req_length = modbus_send_raw_request(ctx, raw_req, 6 * sizeof(uint8_t)); //write
        usleep(9050); //waite until write is finished
        write(fd,"0",1);//After write(), make gpio low to receive messages from sensor.
        int response_length = modbus_receive_confirmation(ctx, rsp);`


    This code is working sometimes..... it also not the best answer. the result is here. After 1'22, it's working.

    enable Pin is connected to FPGA (ZYNQ)

    It is difficult to add other circuit to control enable pin. it is more convenient to make a design on the FPGA.


    f7Ebg.png


    Should I control this by software?(controlling GPIO) or Hardware?

    Let me know the best way, approach.. Thank you.

    Posts(1) | Reviews | Tip post

«Reply to this thread (in Electronics)
Electronics

Reply

Subject:

* 50 characters max

Message:

Please note: HTML codes are not allowed anywhere on this page (otherwise you will see an error).

Please note that DealExtreme Forums are not a sales or product support board. While we do constantly participate in this forum, please contact us via support ticket for a guaranteed fast response. We make every effort to make the quickest replies.

DX Everywhere