Jump to content

seraph333

Members
  • Posts

    10
  • Joined

  • Last visited

Posts posted by seraph333

  1. 22 minutes ago, Fausto said:

    Hello @seraph333.

    Do you have other third-party HAT boards on your Raspberry Pi 2 module?

    Do you know the history of the Raspberry Pi 2 module and whether or not it is reliable?

    If you have a second Raspberry Pi 2 module, then you can spend some time troubleshooting between the two Raspberry Pi 2 modules.

    Otherwise, if the MCC 152 is detectable and functioning on address 0 (no jumpers) with the Raspberry Pi 4 module, then I would suggest using the Raspberry Pi 4 module. 

    Regards,

    Fausto

    Hi, Fausto,

    Thanks for your response.

    I don't have other third-party HAT, but this MCC152 on the RPI 2.

    I don't have any history about this RPI 2, other than it is new, but left in the lab for quite a long time.

    My RPI 4 is used on other project, this MCC 152 HAT is pulled out from that project.

    Since it can be recognized at address 1, can address 0 been left out without any board?

  2. Hi,

    I have a Raspberry pi 2, and a MCC 152.

    The RPI is showing a board at address 0, but not able to list the device, the MCC 152 is not found.

    The MCC 152 was function at my Raspberry Pi 4.

    When I place the jumper at A0, the MCC 152 now is found at address 1, but isn't the manual says "There must always be a board at address 0"

    So why the single board MCC152 cannot be found at address 0?

     

     

    MCC 152 is at address 0, but cannot be found.jpg

  3. 6 minutes ago, Jeffrey said:

      for channel in channels:
            hat0.a_out_write_all(channel, get_input_values)
            hat1.a_out_write_all(channel, get_input_values)
            hat2.a_out_write_all(channel, get_input_values)

    should be:

      for channel in channels:
            hat0.a_out_write(channel, get_input_values)
            hat1.a_out_write(channel, get_input_values)
            hat2.a_out_write(channel, get_input_values)

    I don't know if that will resolve your issue(s) but that is the one that stands out to me.

    if you are getting any other errors, what is the error?

     First:

    except (HatError, ValueError) as error:
        ^
    SyntaxError: invalid syntax

  4. 21 hours ago, Jeffrey said:

    Measurement Computing Application Engineers will answer focused questions on our software and hardware products.

    As you are a self proclaimed newbie, I offer you the following:

    Download and install Pycharm community edition, it is free.  Along with the DAQHats library and examples, it will fit on your Raspberry Pi with lots of room to spare.

    Then load the example analog_output_write_all.py, and run it in debug mode so you can step through the example and see exactly where in the code new value(s) are written out to the DACs.

    The error in the code you sent, was 2 fold.  You placed your code in the wrong place, and function call you used, 'a_out_write_all()' does not take the values you entered.

    That function takes a 1D array ( or 'list' in python) of 2 values.

    the line of code you are looking for is on line 102 or the original example.

    Note there is no parameter for channel as that function writes 1 value out to each of the 2 DACs.

    Don't forget to study the documentation:  https://mccdaq.github.io/daqhats/python.html#daqhats.mcc152.a_out_write_all

    'Give a man a fish and he eats today.  Teach a man to fix and he eats for a lifetime.'

    I'm teaching you how to 'fish'. 

    Regards,

    Jeffrey

    Thanks, Jeffrey,

    I appreciate for the material you provided. It's just at this stage I don't have that much time to start from beginning. I am strong on mechanical design side but not software.

    I am trying to use all the AO to control a LED array.

    Tried to modify the codes, but error just popup here and there, following is the code I am struck with, any little help to me is big.

    def main():
        options = OptionFlags.DEFAULT
        channels = (0,1)
        hat0 = mcc152(0)
        hat1 = mcc152(1)
        hat2 = mcc152(2)
        
        for channel in channels:
            hat0.a_out_write_all(channel, get_input_values)
            hat1.a_out_write_all(channel, get_input_values)
            hat2.a_out_write_all(channel, get_input_values)

        address = select_hat_device(HatIDs.MCC_152)

        run_loop = True
        error = False
        while run_loop and not error:
            try:
                values = get_input_values()
            except ValueError:
                run_loop = False
            else:
                # Write the values.
                
                for hat in range(3):
                    print('     ', hat, end='')
                    if hat == 0:
                        for channel in channels:
                             hat.a_out_write_all(values=values, options=options)
                    elif hat == 1:
                        for channel in channels:
                            hat.a_out_write_all(values=values, options=options)
                    else:
                        for channel in channels:
                            hat.a_out_write_all(values=values, options=options)
                
                except (HatError, ValueError):
                    error = True


    if __name__ == '__main__':
        # This will only be run when the module is called directly.
        main()
     

  5. On 6/20/2022 at 10:26 AM, Jeffrey said:

    Measurement Computing provides you with a host of examples for each type of DAQHat.  They are included so that you can edit them to make them do what you want for your needs. When you purchase any of MCC products, It is assumed you know how to create an app or write a program in a supported app.  Not only are examples provided by also detailed documentation.  For the DAQhats etc the documentation is found here:  https://www.mccdaq.com/Manuals

    I provided you with an additional example demonstrating how to read from 2, MCC 134s for a total of 8 TCs readings.  From that example you can expand on it to make read from any number (up to 8, MCC 134s).  

    As stated my my previous post, 

     

     

    Thanks, Jeffrey.

    Please excuse me as a newbie for python and Raspberry pi.

    I try to write all analog out for 3 MCC 152 HAT, but there always problems to execute. Can you please help?

    I have the file I modified attached.

    Thanks a lot.

     

    analog_output_write_allx3.py

  6. Just now, Jeffrey said:

    The MCC 152 does not have any A/Ds so voltage input is not possible.

    For the code for analog output, please see the example analog_out_write.py, included in the daqhats software found https://github.com/mccdaq/daqhats

    Thanks, Jeffrey.

    I should rephrase as how can I define the raspberry pi to give the MCC 152 a digital signal to output voltage.

    I also has three MCC 134 HATs to take 6 thermocouples temperature, ADC to raspberry pi, compare with the input temperature, then use MCC 152 DAC to control power supply.

    What is the code on raspberry pi to read the 6 thermocouples temperature? What is the code to give MCC 152 the signal.

     

    Thanks a lot.

  7. 3 hours ago, Jeffrey said:

    Please see the attached example.

    regards,

     

    mcc_134_x2.py 4.49 kB · 0 downloads

    Thanks, Jeffrey.

    Another question is for the 

    delay_between_reads = 1.

    Is that possible to set it to less than 1 second? Such as 0.1 second? Or even without delay. Because the thermocouple input is going to compare with the set point then do PID control, to control a heater, the whole heating process supposed to less than 30 seconds. If every time it take 8 seconds to get the input, not sure the correction will be made within 3 loops.

×
×
  • Create New...