Monday, March 20, 2017

Week 5

Week 5

During my fifth week I was finally given the code that will be in the final product, code that I am going to work with. This means that my final code will not reside in some form of a main function. The controller that is going to be implemented in the final product uses almost all of the channels. So with that in mind, I was also informed of what pins and channels I could use for my control loop. This meant that threads were going to be in use. I have never once used a thread before, so it was a learning process. Thankfully the final product code had other examples of threads that were available for use. Using these said examples, it did not take long to replicate something on the same level.

I used the ADC thread as a reference to make my own thread named PWM. The name was in reference to the PWM control needed to be implemented from a reference voltage. This reference voltage, as previously stated, will tell me what temperature the printer is heating the ink at, then my thread is going to react to that value accordingly.
Here is a very basic control loop first used. The circuit used in the printer itself will give a reading of .86V at 20C and 2.11V at 60C. The GetThermVoltage(); method will return this reading accordingly. I also had to invert the incrementing property in my PWMSetDuty method (This method changes the duty cycle on a 0-100% process) in my first if statement. This is because at a voltage of .86, we need a higher PWM output which will decline to 0 at a voltage of 2.11. Now I have to test the code and see what happens when the thermistor itself is heated. That will be my first job for next week.
-3/10/17

No comments:

Post a Comment