PIC programming

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Hi,
Finally Arduino it is running in windows 10. I did some changes to the power ON routine. I added a return every time that you branch to the delay routine and also changed the switch pinmode to input pullout. That it is to prevented the pin to be floating. That may give you random triggering. Please try it and post your finding. I will keep myself learning windows 10.
 

Attachments

  • Rev5problem.txt
    4.7 KB · Views: 37
This should operate the relays. LED operation is a couple more simple function calls. Shutdown order can be rearranged by changing the order of the "digitalWrites" in the "powerOff" function call. Delays can be added for shutdowns there as well. A voltage detector function call needs to be added yet too (that's just a cut and paste). Let me know if you want to use the code and I'll add all the extras.
 

Attachments

  • Tube_Amp_control.zip
    2.1 KB · Views: 31
Hi,
Attached it is the program with new modifications. First I modified the delay routine to set the on_off flag =1 and then do a return, This will aborted the delay routine immediately . The return instruction will take us back to the power on routine. In the power on routine we will check the on_off flag =1 and if it is set then we will aborted the power on routine and take us to the read switch routine. In the read routine we will check the switch and if the on_off flag = 1 and if the switch =0 then that will send the program to the power off routine and turn off all the relays. I removed the read switch instructions in the power on routine since we are checking it in the delay routine. Right now it is working OKAY in my test jig with 4 leds lights. Check it out and report your findings. Hoped you understand the above explained. I don't. Just kidding.
 

Attachments

  • Rev6problem.txt
    4.7 KB · Views: 31
Hi,
First, accept my apologies for annoying you with so many changes. I just did a completed clean up in the program and tested it in my test jig.It ran with not problems. Attached it is the file for you to test it and report back your findings .
 

Attachments

  • Rev6_01_10_2016.txt
    6 KB · Views: 34
Hi,
Yes, finally I took jwilhelm advised. It is was not too hard to learned it. You need to change the delays to seconds now. Now the delay routine will terminate immediately you turn OFF the switch. No 5 seconds delay. Everything worked for me using my test jig. I have 4 led for relay 1,2,3 and 4 that are turn ON following the program sequencing with no problems. Also the program it is more clean. Slowly I am learning how to program the Arduino.
 
One thing you need to remember when using millis is it rolls over to a negative number after 59(?) days. If the microcontroller is going to stay live all the time you need to use an "unsigned long" declaration.

unsigned long currentMillis;

Then wherever you want to reference millis,

currentMillis = millis();

if (currentMillis - ...
 
Looks good at first glance except for a missing LED
StatusLED is really a fault only LED
I have an LED within the power button that needs to turn on after the last Relay is energized.
Take a look at the pictures below
 

Attachments

  • IMG_2459.jpg
    IMG_2459.jpg
    488.4 KB · Views: 62
  • IMG_2488.jpg
    IMG_2488.jpg
    723.1 KB · Views: 64
  • IMG_2502.jpg
    IMG_2502.jpg
    743.1 KB · Views: 59
Last edited:
I misunderstood. I thought you had 2 LEDs. So you have a total of 4 LEDs? I'll separate the protection led functions from the high voltage led. When do you want the ON LED to turn on?
The ON LED is tied to the Arduino power power supply. It's just status for the rear power switch and amp is ready to energize.

Standby LED comes on when pushbutton is closed and sequence started, it turns off when last relay is energized.

ProtectLED is just for power issues, high voltage sensor and any faults (may add future current or temp monitoring). If this LED is on, all others should be off. The number of blinks could be programmed to indicate the fault type.

HighvoltageLED (inside of power switch) tells me that last relay is energized and high voltage is on. If fault occurs or pushbutton is opened, this LED should turn off
 
I'm currently doing some physical therapy on my shoulder and trying to avoid re-injury....
I might get some help this weekend to move these out for some real listening tests.
Also waiting on a couple caps to lower the voltage on the B+ rail.
Right now its about 1225 volts, I need it closer to 1100-1150v. A 5v variation on the primary could easily send this closer to 1300volts! :eek:
 
Last edited:
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.