Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Single pulse from control port, CR1000


gem Aug 16, 2011 01:51 AM

Hi,
The following code snipet works very well in CR10Xpb, I need to upgrade to CR1000's and I must be missing something, can't find an equivalent to P21 instruction in CRBasic.
In short, need to send a single 20 millisecond pulse from a control port when the temperature reaches 90 degrees and another 20 millisecond pulse to another control port when the temperature drops to 85, and count the seconds the water is on.
Any help would be much appreciated.
Thanks,
GEM

; Creates 20 millisecond pulse to firing latching relays

32: Z=F x 10^n (P30)
1: 20 F
2: 00 n, Exponent of 10
3: 7 Z Loc [ milsec ]

; MIST COOLING
; Loop to turn on latching solenoid water valve if air temerature is more than 90F at T107_F_1 sensor.
; Pulses port 3 with 20 millisecond pulse and sets Flag 2 high.

33: Beginning of Loop (P87)
1: 0000 Delay
2: 1 Loop Count

34: If Flag/Port (P91)
1: 12 Do if Flag 2 is High
2: 31 Exit Loop if True

35: If (X<=>F) (P89)
1: 5 X Loc [ T107_F_1 ]
2: 3 >=
3: 90 F
4: 30 Then Do

; port 3 sends 20 millisecond pulse to an H bridge circuit which drives a positive pulse to an Irritrol latching solenoid.

36: Pulse Port w/Duration (P21)
1: 3 Port
2: 7 Pulse Length Loc [ milsec ]

37: Do (P86)
1: 12 Set Flag 2 High

38: End (P95)

39: End (P95)

; MIST COOLING
; Loop to turn off latching solenoid water valve if air temerature is less than 85F at F-1 107 sensor.
; Pulses port 4 with 20 millisecond pulse and sets Flag 2 low.

40: Beginning of Loop (P87)
1: 0000 Delay
2: 1 Loop Count

41: If Flag/Port (P91)
1: 12 Do if Flag 2 is High
2: 30 Then Do

42: If (X<=>F) (P89)
1: 5 X Loc [ T107_F_1 ]
2: 4 <
3: 85 F
4: 30 Then Do

; port 4 sends 20 millisecond pulse to an H bridge circuit which drives a negative pulse to an Irritrol latching solenoid.

43: Pulse Port w/Duration (P21)
1: 4 Port
2: 7 Pulse Length Loc [ milsec ]

44: Do (P86)
1: 22 Set Flag 2 Low

45: End (P95)

46: End (P95)

47: End (P95)

48: If Flag/Port (P91)
1: 12 Do if Flag 2 is High
2: 30 Then Do

; increment counter locations by 10
; Mist Cooling times MCsec1 is 15 minute totals, MCsec2 is 24 hr totals

49: Z=X+F (P34)
1: 12 X Loc [ MCsec1 ]
2: 10 F
3: 12 Z Loc [ MCsec1 ]

50: Z=X+F (P34)
1: 14 X Loc [ MCsec2 ]
2: 10 F
3: 14 Z Loc [ MCsec2 ]

51: End (P95)


IslandMan Aug 16, 2011 01:19 PM

I believe "PulsePort" in CRBasic provides the same function. You can use "Timer" to measure the time.

Have you tried using Transformer to convert your CR10X programs to CRBasic? It works pretty well and might save you some time.


gem Aug 16, 2011 10:18 PM

Thanks IslandMan,
I think I misread the instruction when I was looking at it earlier.
As I read it now,
PulsePort (3 ,20000)
would turn on port 3 for 20 milliseconds and then turn off port 3 and then wait another 20 milliseconds? If so, that will do the job perfectly. (I hope)

I'm right that I'll still need to run this in a loop? I only want 1 pulse when the temps get over 90 degrees, not ever scan (10sec) while it is over 90 degrees.

I'll look at Timer but I'll first get the valves turning on and off and the worry about getting the number of seconds a valve is on later....

I did try and run the program through Transformer but it wouldn't even try to run it, errored out, program is table based, not supported.
I tried putting the code above in an array based CR10X program but it still wouldn't convert it. said something about no equivalent to instruction 21.
I was going to put that in my post but thought I might be a little to wordy:(
GEM


Sam Aug 17, 2011 12:52 AM

You might also want to look at PWM() or a combination of WriteIO() and Delay(1,X,X).

Log in or register to post/reply in the forum.