Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - garysdickinson

Pages: 1 ... 27 28 [29] 30 31 ... 34
421
Technical support / Re:nano PWM outputs
« on: June 22, 2011, 10:09:05 AM »
Your approach is pretty well though out.

I took a look at one of my nano-10 boards and traced the output circuit.  They appear to use a desecrate power MOSFET with a 5.6K pull up with a red LED.  The interesting observation is that the pull up is not tied directly to the 24V input, but to a diode connected to the 24V input.

The single diode will prevent current from the 48V supply from flowing through your load to the 24V supply.  The motor won't turn and the output LEDs won't pop because of the reverse bias.

But, there is only one diode in the nano output circuit and it is shared by all 4 outputs.  If you have a load connected to 48V and the output is
 off, the other outputs will be pulled up to your 48V supply through your load.  This may cause some issuses (output LEDs may melt and/or the 5.6K resistors may momentarily emit light/smoke when the other outputs go active.  The current that flows thru the other 3 output's LEDs will be sourced through your motor load.

You still may want to consider an external solution.  If you are already using a SSR to handle the motor direction issue, you might want to use another SSR for the pwd issue.  You may want to look at something called an "h-bridge driver".


Gary d

422
Technical support / Re:nano PWM outputs
« on: June 21, 2011, 07:04:53 PM »
I would be very careful with attempting to directly drve a load that is connected to a supply with a voltage different than the 24VDC running the PLC.

My concern is with the off state of the nano output pin.  Traditionally the TRI PLCs have used an output driver chip similar to the ULN2001. The nano doesn't, but I'll bet their circuitry is substantially similar.

The ULN2001 has protection diodes that are connected to each output pin and the the 24V supply.  This was done to prevent the flyback voltage that occurs when driving inductive loads from destroying the output transistors.

When the PLC output is OFF their is a path from the 48V supply though your load via the protection diode to the 24V supply.  The end result is that the motor will see 24V when the output is OFF and 48V when the output is ON.

I'd suggest using transistors external to the PLC to handle your 48V loads.  Because your DC motor is a highly inductive load, you would be wise to pick transistors that will not be damaged by voltages substantially higher than the 48V supply.

Gary d


423
Technical support / Re:24Vdc uniterrupted power supply
« on: June 15, 2011, 04:59:25 PM »
You're size requirements will be difficult to meet.  

Do a google search for a Mean Well DR-UPS40.  This unit provides the charge controller functionallity.  You have to supply the back up batteries and and a 24VDC supply.  The DC supply must be sized to be able to run your system + another 2A to be used for battery charging.

The DR-UPS40 runs off the 24VDC supply, so it doesn't care if your local power is 230VAC.

It's a good starting point and at about $60 you can't go wrong.  You won't get too much custom built at this price.

Gary d

424
Technical support / Re:Motor Speed control
« on: June 10, 2011, 02:14:19 PM »
I'd suggest using stepper motors.  The PLC provides very good support for steppers. You will probably need an external stepper driver to handle converting the PLC step and direction signals to the high current drive required by most steppers.

If you are looking for very low cost, RC servos are the cheapest approach to moving stuff that i've ever found.  The PLC's PWM system can be tricked into controlling these servos.  

Are you trying to build a multiple-axis system? If this is the case then you should listen to the people.  I consider this to be beyond the capabilities of the PLC unless you spend big money on external hardware.

Gary d

425
Technical support / Re:Motor Speed control
« on: June 09, 2011, 02:50:23 PM »
I assume that if you are using a quadrature encoder (A and B phase outputs) that you are building some nature of servo positioning system.

Using a simple circuit such as what can be done with a CD4013 or CD4040 to divide the incoming frequency of both phases by 4 will not preserve the phase relationship of the original A and B signals. This will confuse the crap out of the quadrature decode mechanism in the PLC.  

If you are using a quadrature encoder and "looking" at only a single phase, then I assume that you are only interested in counting shaft revolutions.  If this is the case then, I'd ask, "why are you using an expensive encoder when a cheaper one would be fine?".

If you are only interested in counting shaft revolutions, and cannot use a more appropriate encoder, then a simple divide by 4 circuit might be a reasonable method to better match your system to the PLCs capabilities.

Gary d






426
Technical support / Re:Motor Speed control
« on: June 07, 2011, 03:26:25 PM »
If you are talking about a quadrature encoder (2 outputs: A and B phase) then ignore this reply.  

If you are talking about an encoder that simply generates pulses as the motor turns and does not provide any direction information, then read on..

To go from 1024 pulses / revolution to 400 pulses / revolution is not a simple task.  1024/400 = 2.56... The answer for this problem is way out of your depth.

Why not divide the 1024 by 4 and get 256 pulses per revolution?

Dividing by 4 is pretty simple task using both sections of a CD4013 (dual d flip-flop).

Another device to consider is the CD4040.  It can divide an incoming signal by 2,4,8,16,..4096.  If you picked the divide by 4096 output you would get 1 pulse every 4 revolutions.

Gary D


427
Technical support / Re:need to calculate CRC - CCITT
« on: May 16, 2011, 05:32:27 PM »
Look at the TBASIC function, CRC16.  This will probably do the trick.

Gary d

428
Technical support / Re:need to calculate CRC - CCITT
« on: May 16, 2011, 05:16:16 PM »
Short answer, yes.  TBASIC supports enough bit operators to allow you to write code equivalent to the C example. The TBASIC version will be a bit less eloquent then the C version.

The is some built-in support for calculating CRCs in TBASiC. I suspect that it uses the same feedback terms as the CRC16-CCITT

Unfortunately I'm away form my computers and can't give you an example.

Gary d

429
Technical support / CHR$(N) incorrect Documentation
« on: April 28, 2011, 12:50:59 PM »
The CHR$(n) function is incorrectly documented:

"To convert a number n into its corresponding ASCII character. n must be a numeric constant (0 to 255)"

The range of n is limited to 1..255.  This limitation is consistent with most variants of BASIC. The value of &H00 is used to mark the end of a string in many versions of BASIC.  Your documentation for ASC(x$,n) hints that this is the case for TBASIC.

If n is set to a value of 0, it will break the simulator in TRiLOGI V 6.40 build 02.

The following code will compiles w/o error but fails during simulation.  No error message is issued by the simulator, but the 2nd line of code is not executed (A is not set to 255).


A$ = chr$(0)      ' illegal value for chr$()
A = 255           ' this line of code does not execute


Just add it to your list of small things.

Gary D.

430
Technical support / Re:Serial communications
« on: April 21, 2011, 02:59:42 PM »
I'll give it one more try.  

Let's say your did something like this:

1. Did something to request data from some external device.

2. Wait 1 second to ensure:
    Request was sent to the external device
    Request was processed by the external device
    External device sent the requested data.
    PLC has buffered up all received data bytes

3. Now, assuming everything went as planned,  do something like the following to build a string in A$:


A$ = ""                ' Empty string
D  = INCOMM(1)         ' get first data byte (if any)

WHILE(D <> -1)         ' While data is available
   A$ = A$ + CHR$(D)   '   assemble string
   D  = INCOMM(1)      '   get next data byte (if any)
ENDWHILE

' At this point, A$ contains any and all data received from the
' external device.
'



Gary D.

431
Technical support / Re:Serial communications
« on: April 21, 2011, 11:47:04 AM »
I don't actually think that I can really help all that much.

Your description that strings change value with time is nonsensical. If a string variable changes, it is because your programming changed the string.

Sorry,

Gary d

432
Technical support / Re:Serial communications
« on: April 21, 2011, 07:54:14 AM »
Concatenation.

if A$ +"A" and X$ = "B",
    then  concatenate:

         A$ = A$+X$

A$ will now be "AB"

As for the /FF you are seeing returned from INCOMM() is probably one of 2 things:

1.  It is actual data received from your external device
2.  -- OR -- INCOMM() is documented to return a numeric -1 value
     to indicate that NO character has been
     received from the external device since the last time that
     you called INCOMM().

     Remember that a decimal -1 is a string of "f"s in hexadecimal.

Gary D


433
Technical support / Re:Serial communications
« on: April 20, 2011, 08:57:47 PM »
In regards to your error in compilation

PRINT #1 "50003402000E000DFF" + STR$(C$) +"50"

This line should NOT compile.  The problem is with str$(c$).  Str$() expects an integer as an argument.  C$ is a string!

Sorry for not catching this, earlier.

Gary d

434
Technical support / Re:Serial communications
« on: April 20, 2011, 08:49:06 PM »
incomm() is your last resort.

If your incoming data is not delimitated by ASCII <cr> characters, then your only choice is to use incomm().  In these cases, your code will have to handle each character received from the external device and figure out what is data and what is chaff.

Yes this function does return an 8-bit integer value.  If you need to convert the value returned by incomm() to an ASCII character, you can use chr$()

A$ = chr$(incomm(4)) 'poof a$ now contains a single ASCII character

Gary d

Gary d

435
Technical support / Re:Serial communications
« on: April 13, 2011, 08:32:27 AM »
Can't help with your PRINT statement.  The isolated statement complies for me.  I'm guessing that your have messed up the "(" or some other syntax junk in a previous line.

In regards to calculating a Checksum (sumcheck) it is pretty simple.

If you concatenate the strings that need the the sumcheck in  A$, then call a custom function that appends the appropriate sumcheck value onto A$, then you can send A$ on it's way.  Something like this is a good starting point:


' SumCheck
'
' On entry A$ holds ASCII string
'
' On exit A$ holds ASCII string with checksum appended
'   Integer variable used: I,S,N
'
'
S = 0               'Starting point for SumCheck
N = LEN(A$)   

FOR I = 1 TO N         ' For each ASCII char in string
   S = S + ASC(A$,I)
NEXT

S = S & &HFF         ' Toss out everything but 8 bits
A$ = A$ + HEX$(S,2)   ' Tack on sucmcheck



Since there are no absolute rules on how checksums are calculated, you may need to adjust the algorithm to fit the rules for your communication protocol.

Gary d.

Pages: 1 ... 27 28 [29] 30 31 ... 34