Uaktualnienie LinuxCNC - MB2HAL - pliki w C jak to zrobić?

jak skompilować ? by sterować falownikiem

Dyskusje dotyczące działania obsługi programu LinuxCNC
Awatar użytkownika

Autor tematu
adam Fx
Lider FORUM (min. 2000)
Lider FORUM (min. 2000)
Posty w temacie: 7
Posty: 5562
Rejestracja: 04 lip 2004, 16:03
Lokalizacja: Gliwice

Uaktualnienie LinuxCNC - MB2HAL - pliki w C jak to zrobić?

#1

Post napisał: adam Fx » 08 maja 2019, 07:17

Cześć
zacznę od końca jak zaktualizować MB2HAL w linuxcnc?
tu są chyba nowe poprawione rzeczy w C
https://github.com/LinuxCNC/linuxcnc/tr ... mps/mb2hal

https://translate.googleusercontent.com/translate_c

polecenie głosi Potrzebujesz LinuxCNC > 2.7.14 (np. Następna wersja od października 2018), gałęzi master lub musisz skompilować mb2hal samodzielnie za pomocą żądań pull [# 487] i [# 489] .

skompilować mb2hal samodzielnie za pomocą żądań pull [# 487] i [# 489] . jak to zrobić
http://wiki.linuxcnc.org/cgi-bin/wiki.p ... arker_AC10

nabyłem już konwerter i nawet w miarę kumam modbus by coś zmienić teraz pora to ożenić z linuxcnc

https://youtu.be/zFH4ERxJMcw


a tu moja droga przez mękę dla zainteresowanych:

w wolnych chwilach walczę z MB2HAL
http://linuxcnc.org/docs/html/drivers/mb2hal.html
na podstawie tego projektu http://wiki.linuxcnc.org/cgi-bin/wiki.p ... arker_AC10 chciałem sterować swoim falownikiem

założyłem że w najnowszej wersji linuxcnc będzie najnowszy MB2HAL ale chyba się myliłem:
najpierw sypało błędem że brak
NELEMENTS= (bo autor zastąpił to PIN_NAMES ale chyba jest w linuxcnc niekatulana wersja bo nadal chce NELEMENTS=)
powinno działać według info z https://github.com/LinuxCNC/linuxcnc/bl ... _HOWTO.ini

#REQUIRED unless PINN_NAMES is specified: The number of elements.
#It is an error to specify both NELEMENTS and PIN_NAMES
#The pin names will be sequential numbers e.g mb2hal.plcin.01
NELEMENTS=16

#REQUIRED unless NELEMENTS is specified: A list of element names.
#these names will be used for the pin names, e.g mb2hal.plcin.cycle_start
#NOTE: there must be no white space characters in the list
PIN_NAMES=cycle_start,stop,feed_hold

ok zmieniłem na NELEMENTS=

to poszło ale - kolejny błąd że nie obsługuje fnct_06_write_single_register


sorki za wszystkie błędy ... (dyslektyk) :?
Zobacz moje filmy http://www.youtube.com/user/pokachontass/videos


gniazdo
Sympatyk forum poziom 2 (min. 50)
Sympatyk forum poziom 2 (min. 50)
Posty w temacie: 5
Posty: 61
Rejestracja: 24 gru 2008, 22:09
Lokalizacja: Limanowa

Re: Uaktualnienie LinuxCNC - MB2HAL - pliki w C jak to zrobić?

#2

Post napisał: gniazdo » 08 maja 2019, 12:23

założyłem że w najnowszej wersji linuxcnc będzie najnowszy MB2HAL ale chyba się myliłem:
a jaka wersja to najnowsza wersja?

jest w najnowszej wersji tyle ze ta wersja to "2.8.0~pre1" a nie 2.7.14 zresztą nowa wersja dodaje obsługę "fnct_06_write_single_register" która była potrzebna autorowi do obsługi tego parkera, oraz kasowanie nie odczytanych ramek po błędzie komunikacji.

co do reszty pokaz co ty tam nawydziwiałeś w pliku ini do konfiguracji mb2hal

ps.
NELEMENTS=4 -ilość elementów do pobrania
oraz
PIN_NAMES=0,1,2,3 -ilość elementów do pobrania z tym ze przypisujesz im nazwy po kolei oddzielając przecinkiem
w zasadzie to samo.

Awatar użytkownika

Autor tematu
adam Fx
Lider FORUM (min. 2000)
Lider FORUM (min. 2000)
Posty w temacie: 7
Posty: 5562
Rejestracja: 04 lip 2004, 16:03
Lokalizacja: Gliwice

Re: Uaktualnienie LinuxCNC - MB2HAL - pliki w C jak to zrobić?

#3

Post napisał: adam Fx » 08 maja 2019, 16:33

instaluje linuxcnc ze strony linuxcnc gdzie napisane jest jak byk że aktualna wersja to 2.7.14 (pewnie chodzi że aktualna stabilna)

Pewnie znajdę gdzieś instr. do zrobienia aktualizacji do 2.8.0~pre1 mam jednak obawę czy naprawiając nieaktualność MB2HAL nie napotkam na jakieś dziwne problemy wynikające z wersji 2.8.0~pre1

autor twierdzi że jakoś ręcznie można dodać do 2.7.14 poprawki MB2HAL
gniazdo pisze:co do reszty pokaz co ty tam nawydziwiałeś w pliku ini do konfiguracji mb2hal
to nie ma sensu wszystko co zrobiłem było bez znaczenia bo błąd wynika ze starej wersji która nie czyta np. PIN_NAMES czy polecenia odczytu poj. rejst 06.
sorki za wszystkie błędy ... (dyslektyk) :?
Zobacz moje filmy http://www.youtube.com/user/pokachontass/videos


gniazdo
Sympatyk forum poziom 2 (min. 50)
Sympatyk forum poziom 2 (min. 50)
Posty w temacie: 5
Posty: 61
Rejestracja: 24 gru 2008, 22:09
Lokalizacja: Limanowa

Re: Uaktualnienie LinuxCNC - MB2HAL - pliki w C jak to zrobić?

#4

Post napisał: gniazdo » 08 maja 2019, 17:08

tak zwłaszcza ze tobie to polecenie jest do niczego nie potrzebne bo możesz skorzystać z "fnct_16_write_multiple_registers" i wpisać NELEMENTS=1

ale skoro się nie da to nie.


poprawki na pewno się da:
https://github.com/LinuxCNC/linuxcnc/pull/487/files

tylko w twoim przypadku nie są ci potrzebne ale spoko

masz tu działający config z yaskawy v1000 (linuxcnc 2.7.14) bo widzę ze szukasz dziury w całym

Kod: Zaznacz cały

 #This .INI file is also the HELP, MANUAL and HOW-TO file for mb2hal.

 #Load the modbus HAL userspace module as the examples below,
 #change to match your own HAL_MODULE_NAME and .ini file name
 #Using HAL_MODULE_NAME=mb2hal or nothing (default): loadusr -W mb2hal config=config_file.ini
 #Using HAL_MODULE_NAME=mymodule: loadusr -Wn mymodule mb2hal config=config_file.ini

 #Common section

[MB2HAL_INIT]

 #OPTIONAL: Debug level of init and INI file parsing.
 # 0 = silent.
 # 1 = error messages (default).
 # 2 = OK confirmation messages.
 # 3 = debugging messages.

INIT_DEBUG=0

 #OPTIONAL: HAL module (component) name. Defaults to "mb2hal".

HAL_MODULE_NAME=VFD

 #OPTIONAL: Insert a delay of "FLOAT seconds" between transactions in order
 #to not to have a lot of logging and facilitate the debugging.
 #Usefull when using DEBUG=3 (NOT INIT_DEBUG=3)
 #It affects ALL transactions.
 #Use "0.0" for normal activity.

SLOWDOWN=0.0

 #REQUIRED: The number of total Modbus transactions. There is no maximum.

TOTAL_TRANSACTIONS=10

 #One transaction section is required per transaction, starting at 00 and counting up sequentially.
 #If there is a new link (not transaction), you must provide the REQUIRED parameters 1st time.
 #Warning: Any OPTIONAL parameter not specified are copied from the previous transaction.

[TRANSACTION_00]

 #REQUIRED: You must specify either a "serial" or "tcp" link for the first transaction.
 #Later transaction will use the previous transaction link if not specified.

LINK_TYPE=serial

 #if LINK_TYPE=tcp then REQUIRED (only 1st time): The Modbus slave device ip address.
 #if LINK_TYPE=serial then IGNORED

TCP_IP=192.168.2.10

 #if LINK_TYPE=tcp then OPTIONAL.
 #if LINK_TYPE=serial then IGNORED
 #The Modbus slave device tcp port. Defaults to 502.

TCP_PORT=502

 #if LINK_TYPE=serial then REQUIRED (only 1st time).
 #if LINK_TYPE=tcp then IGNORED
 #The serial port.

SERIAL_PORT=/dev/ttyUSB0

 #if LINK_TYPE=serial then REQUIRED (only 1st time).
 #if LINK_TYPE=tcp then IGNORED
 #The baud rate.

SERIAL_BAUD=9600

 #if LINK_TYPE=serial then REQUIRED (only 1st time).
 #if LINK_TYPE=tcp then IGNORED
 #Data bits. One of 5,6,7,8.

SERIAL_BITS=8

 #if LINK_TYPE=serial then REQUIRED (only 1st time).
 #if LINK_TYPE=tcp then IGNORED
 #Data parity. One of: even, odd, none.

SERIAL_PARITY=none

 #if LINK_TYPE=serial then REQUIRED (only 1st time).
 #if LINK_TYPE=tcp then IGNORED
 #Stop bits. One of 1, 2.

SERIAL_STOP=1

 #if LINK_TYPE=serial then OPTIONAL:
 #if LINK_TYPE=tcp then IGNORED
 #Serial port delay between for this transaction only.
 #In ms. Defaults to 0.

SERIAL_DELAY_MS=5

 #REQUIRED (only 1st time).
 #Modbus slave number.

MB_SLAVE_ID=31

 #REQUIRED: The first element address.

FIRST_ELEMENT=1

 #REQUIRED: The number of elements.

NELEMENTS=1

 #REQUIRED: Modbus transaction function code (see www.modbus.org specifications).
 #    fnct_02_read_discrete_inputs     (02 = 0x02)
 #    fnct_03_read_holding_registers   (03 = 0x03)
 #    fnct_04_read_input_registers     (04 = 0x04)
 #    fnct_15_write_multiple_coils     (15 = 0x0F)
 #    fnct_16_write_multiple_registers (16 = 0x10)

 #fnct_02_read_discrete_inputs: creates boolean output HAL pins.
 #fnct_03_read_holding_registers: creates a floating point output HAL pins.
 #                           also creates a u32 output HAL pins.
 #fnct_04_read_input_registers: creates a floating point output HAL pins.
 #                         also creates a u32 output HAL pins.
 #fnct_15_write_multiple_coils: creates boolean input HAL pins.
 #fnct_16_write_multiple_registers: creates a floating point input HAL pins.

 #The pins are named based on component name, transaction number and order number.
 #Example: mb2hal.00.01 (transaction=00, second register=01 (00 is the first one))

MB_TX_CODE=fnct_16_write_multiple_registers

 #OPTIONAL: Response timeout for this transaction. In INTEGER ms. Defaults to 500 ms.
 #This is how much to wait for 1st byte before raise an error.

#MB_RESPONSE_TIMEOUT_MS=500

 #OPTIONAL: Byte timeout for this transaction. In INTEGER ms. Defaults to 500 ms.
 #This is how much to wait from byte to byte before raise an error.

#MB_BYTE_TIMEOUT_MS=500

 #OPTIONAL: Instead of giving the transaction number, use a name.
 #Example: mb2hal.00.01 could become mb2hal.plcin.01
 #The name must not exceed 32 characters.
 #NOTE: when using names be careful that you dont end up with two transactions
 #usign the same name.

HAL_TX_NAME=Operation_Signals

 #OPTIONAL: Maximum update rate in HZ. Defaults to 0.0 (0.0 = as soon as available = infinit).
 #NOTE: This is a maximum rate and the actual rate may be lower.
 #If you want to calculate it in ms use (1000 / required_ms).
 #Example: 100 ms = MAX_UPDATE_RATE=10.0, because 1000.0 ms / 100.0 ms = 10.0 Hz

MAX_UPDATE_RATE=10.0

 #OPTIONAL: Debug level for this transaction only.
 #See INIT_DEBUG parameter above.

DEBUG=0

 #While DEBUGGING transactions note the returned "ret[]" value correspond to:
 #/* Modbus protocol exceptions */
 #ILLEGAL_FUNCTION        -0x01 the FUNCTION code received in the query is not allowed or invalid.
 #ILLEGAL_DATA_ADDRESS    -0x02 the DATA ADDRESS received in the query is not an allowable address for the slave or is invalid.
 #ILLEGAL_DATA_VALUE      -0x03 a VALUE contained in the data query field is not an allowable value or is invalid.
 #SLAVE_DEVICE_FAILURE    -0x04 SLAVE (or MASTER) device unrecoverable FAILUER while attemping to perform the requested action.
 #SERVER_FAILURE          -0x04 (see above).
 #ACKNOWLEDGE             -0x05 This response is returned to PREVENT A TIMEOUT in the master.
 #                              A long duration of time is required to process the request in the slave.
 #SLAVE_DEVICE_BUSY       -0x06 The slave (or server) is BUSY. Retrasmit the request later.
 #SERVER_BUSY             -0x06 (see above).
 #NEGATIVE_ACKNOWLEDGE    -0x07 Unsuccessful programming request using function code 13 or 14.
 #MEMORY_PARITY_ERROR     -0x08 SLAVE parity error in MEMORY.
 #GATEWAY_PROBLEM_PATH    -0x0A (-10) Gateway path(s) not available.
 #GATEWAY_PROBLEM_TARGET  -0x0B (-11) The target device failed to repond (generated by master, not slave).
 #/* Program or connection */
 #COMM_TIME_OUT           -0x0C (-12)
 #PORT_SOCKET_FAILURE     -0x0D (-13)
 #SELECT_FAILURE          -0x0E (-14)
 #TOO_MANY_DATAS          -0x0F (-15)
 #INVALID_CRC             -0x10 (-16)
 #INVALID_EXCEPTION_CODE  -0x11 (-17)



[TRANSACTION_01]
MB_TX_CODE=fnct_03_read_holding_registers
HAL_TX_NAME=Drive_Status
FIRST_ELEMENT=32
NELEMENTS=1
MAX_UPDATE_RATE=0.0
DEBUG=0

[TRANSACTION_02]
MB_TX_CODE=fnct_03_read_holding_registers
HAL_TX_NAME=Fault_Contents_1
FIRST_ELEMENT=33
NELEMENTS=1
MAX_UPDATE_RATE=0.0
DEBUG=0

[TRANSACTION_03]
MB_TX_CODE=fnct_03_read_holding_registers
HAL_TX_NAME=Output_Frequency_RPM
FIRST_ELEMENT=62
NELEMENTS=1
MAX_UPDATE_RATE=0.0
DEBUG=0

[TRANSACTION_04]
MB_TX_CODE=fnct_03_read_holding_registers
HAL_TX_NAME=Drive_Status_2
FIRST_ELEMENT=44
NELEMENTS=1
MAX_UPDATE_RATE=0.0
DEBUG=0

[TRANSACTION_05]
MB_TX_CODE=fnct_03_read_holding_registers
HAL_TX_NAME=DC_Bus_Voltage
FIRST_ELEMENT=49
NELEMENTS=1
MAX_UPDATE_RATE=0.0
DEBUG=0

[TRANSACTION_06]
MB_TX_CODE=fnct_03_read_holding_registers
HAL_TX_NAME=Output_Power
FIRST_ELEMENT=38
NELEMENTS=1
MAX_UPDATE_RATE=0.0
DEBUG=0

[TRANSACTION_07]
MB_TX_CODE=fnct_16_write_multiple_registers
HAL_TX_NAME=Frequency_Reference_IN
FIRST_ELEMENT=2
NELEMENTS=1
MAX_UPDATE_RATE=0.0
DEBUG=0

[TRANSACTION_08]
MB_TX_CODE=fnct_03_read_holding_registers
HAL_TX_NAME=Alarm_Contents_1
FIRST_ELEMENT=42
NELEMENTS=1
MAX_UPDATE_RATE=0.0
DEBUG=0

[TRANSACTION_09]
MB_TX_CODE=fnct_03_read_holding_registers
HAL_TX_NAME=Fault_Contents_2
FIRST_ELEMENT=41
NELEMENTS=1
MAX_UPDATE_RATE=0.0
DEBUG=0


Awatar użytkownika

Autor tematu
adam Fx
Lider FORUM (min. 2000)
Lider FORUM (min. 2000)
Posty w temacie: 7
Posty: 5562
Rejestracja: 04 lip 2004, 16:03
Lokalizacja: Gliwice

Re: Uaktualnienie LinuxCNC - MB2HAL - pliki w C jak to zrobić?

#5

Post napisał: adam Fx » 08 maja 2019, 18:12

gniazdo pisze:tak zwłaszcza ze tobie to polecenie jest do niczego nie potrzebne bo możesz skorzystać z "fnct_16_write_multiple_registers" i wpisać NELEMENTS=1


chyba nie (mam ta samą sytuacje co autor)
obsługiwane są:
Function Code
(hex) Designation Description
03 Read Holding Registers Reading of the holding registers in the slave (process data, parameters, configuration)
A master request enables up to 11 registers to be read
04 Read Input Registers Reading of the input registers in the slave (process data, parameters, configuration)
A master request enables up to 11 registers to be read
06 Write Single Register Writing of a holding register in the slave
With a general telegram (Broadcast) the appropriate holding registers are written in all slaves
The register is read back for comparison
10 Write Multiple Register Writing of several holding registers in the slave
With a general telegram (Broadcast) the appropriate holding registers are written in all slaves
A master request enables up to 11 registers to be read

instr.do MMX12AA9D6F0-0 - EATON MOELLER http://www.eaton.com/ecm/idcplg?IdcServ ... N04020003E

gniazdo pisze:bo widzę ze szukasz dziury w całym
działam po omacku więc może tak być:)

a to dopiero początek bo potem muszę rozwinąć to tak by sterować 3 wrzeciona i zmieniać ich parametry :) (ale to dalsza perspektywa)

Dodane 4 minuty 13 sekundy:
aha dzięki za ten INI czy jest do tego jakiś plik HAL?- chętnie bym sobie to przeanalizował
sorki za wszystkie błędy ... (dyslektyk) :?
Zobacz moje filmy http://www.youtube.com/user/pokachontass/videos


gniazdo
Sympatyk forum poziom 2 (min. 50)
Sympatyk forum poziom 2 (min. 50)
Posty w temacie: 5
Posty: 61
Rejestracja: 24 gru 2008, 22:09
Lokalizacja: Limanowa

Re: Uaktualnienie LinuxCNC - MB2HAL - pliki w C jak to zrobić?

#6

Post napisał: gniazdo » 08 maja 2019, 19:13

chciałem tylko napisać
10 Write Multiple Register
10 hex (system szesnastkowy) = 16 dec (system dziesiętny)

strona 134 instrukcji:

Kod: Zaznacz cały

Function Code
(hex) Designation Description
03 Read Holding Registers Reading of the holding registers in the slave (process data, parameters, configuration)
A master request enables up to 11 registers to be read
04 Read Input Registers Reading of the input registers in the slave (process data, parameters, configuration)
A master request enables up to 11 registers to be read
06 Write Single Register Writing of a holding register in the slave
With a general telegram (Broadcast) the appropriate holding registers are written in all slaves
The register is read back for comparison
10 Write Multiple Register Writing of several holding registers in the slave
With a general telegram (Broadcast) the appropriate holding registers are written in all slaves
A master request enables up to 11 registers to be read
a jest hal ale jak go zobaczysz to ci ze 3 lata zajmie co jest co zwłaszcza ze są w nim użyte komponenty pisane przeze mnie.

Awatar użytkownika

Autor tematu
adam Fx
Lider FORUM (min. 2000)
Lider FORUM (min. 2000)
Posty w temacie: 7
Posty: 5562
Rejestracja: 04 lip 2004, 16:03
Lokalizacja: Gliwice

Re: Uaktualnienie LinuxCNC - MB2HAL - pliki w C jak to zrobić?

#7

Post napisał: adam Fx » 08 maja 2019, 19:45

OK czyli kolejna rzecz która mnie urzeka w tej komunikacji konwersja hex dec bin jak by nie mogło to gadać w jednym języku ze sobą:P
dobra czyli 10 to znaczy 16 :) wszystko jasne
sorki za wszystkie błędy ... (dyslektyk) :?
Zobacz moje filmy http://www.youtube.com/user/pokachontass/videos

Awatar użytkownika

Autor tematu
adam Fx
Lider FORUM (min. 2000)
Lider FORUM (min. 2000)
Posty w temacie: 7
Posty: 5562
Rejestracja: 04 lip 2004, 16:03
Lokalizacja: Gliwice

Re: Uaktualnienie LinuxCNC - MB2HAL - pliki w C jak to zrobić?

#8

Post napisał: adam Fx » 09 maja 2019, 02:40

gniazdo pisze:a jest hal ale jak go zobaczysz to ci ze 3 lata zajmie co jest co zwłaszcza ze są w nim użyte komponenty pisane przeze mnie.
Jeśli obawiasz się tylko o to to niema problemu chętnie podejmę ryzyko. Ale nie będę też naciskał w końcu włożyłeś na pewno w to sporo czasu i pracy i to Twoja prywatna własność.
sorki za wszystkie błędy ... (dyslektyk) :?
Zobacz moje filmy http://www.youtube.com/user/pokachontass/videos


gniazdo
Sympatyk forum poziom 2 (min. 50)
Sympatyk forum poziom 2 (min. 50)
Posty w temacie: 5
Posty: 61
Rejestracja: 24 gru 2008, 22:09
Lokalizacja: Limanowa

Re: Uaktualnienie LinuxCNC - MB2HAL - pliki w C jak to zrobić?

#9

Post napisał: gniazdo » 10 maja 2019, 07:30

MIECIO-2.7-gmoccapy

Kod: Zaznacz cały

# Generated by PNCconf at Wed Feb 22 09:06:31 2017
# Jeśli zmodyfikujesz ten plik zmainy zostaną
# overwritten when you run PNCconf again

loadrt trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt hostmot2
loadrt hm2_eth board_ip="10.10.10.10" config="firmware=hm2/7i76/7i76e.BIT num_encoders=1 num_pwmgens=0 num_stepgens=5 sserial_port_0=1xxxx" 

#mesa 7i76e modes [0,1,2] selection sserial_port_0=
#0xxxx // 1xxxx // 2xxxx 

setp   hm2_7i76e.0.watchdog.timeout_ns 5000000
loadrt pid names=pid.x,pid.y,pid.z,pid.s
loadrt classicladder_rt numPhysInputs=15 numPhysOutputs=15 numS32in=1 numS32out=1 numFloatIn=1 numFloatOut=1

loadusr -Wn VFD mb2hal config=VFD.ini
loadrt threads name1=slow period1=100000000 

#Spindle VFD Fault invert

loadrt not count=1
addf not.0 servo-thread

#VFD comp

loadrt V1000 count=1
addf V1000.0 slow

#

loadrt Dupl count=4
addf Dupl.0 slow
addf Dupl.1 slow
addf Dupl.2 slow
addf Dupl.3 slow

#vfd limit

loadrt  limit1 count=1
addf limit1.0 servo-thread

#

loadrt and2 count=7
loadrt or2 count=8
loadrt toggle count=1
loadrt toggle2nist count=1
loadrt logic count=1 personality=0x103

#

loadrt scale names=torqueX-scale,torqueYL-scale,torqueYR-scale,torqueZ-scale

addf torqueX-scale slow
addf torqueYL-scale slow
addf torqueYR-scale slow
addf torqueZ-scale slow

#

addf classicladder.0.refresh servo-thread
addf hm2_7i76e.0.read          servo-thread
addf motion-command-handler   servo-thread
addf motion-controller        servo-thread
addf pid.x.do-pid-calcs       servo-thread
addf pid.y.do-pid-calcs       servo-thread
addf pid.z.do-pid-calcs       servo-thread
addf pid.s.do-pid-calcs       servo-thread
addf hm2_7i76e.0.write         servo-thread
setp hm2_7i76e.0.dpll.01.timer-us -50
setp hm2_7i76e.0.stepgen.timer-number 1

#

addf and2.0 slow
addf and2.1 slow
addf and2.2 slow
addf and2.3 slow
addf and2.4 slow
addf and2.5 slow
addf and2.6 slow
addf or2.0 slow
addf or2.1 slow
addf or2.2 slow
addf or2.3 slow
addf or2.4 slow
addf or2.5 slow
addf or2.6 slow
addf or2.7 slow
addf toggle.0 slow
addf toggle2nist.0 slow
addf logic.0 slow

#

net AC1 <= VFD.Alarm_Contents_1.00.int => V1000.0.VFD-AC1-in
net FC1 <= VFD.Fault_Contents_1.00.int => V1000.0.VFD-FC1-in
net FC2 <= VFD.Fault_Contents_2.00.int => V1000.0.VFD-FC2-in
net DS1 <= VFD.Drive_Status.00.int 	=> V1000.0.VFD-DS-in
net DS2 <= VFD.Drive_Status_2.00.int 	=> V1000.0.VFD-DS2-in
net OPOUT => V1000.0.VFD-OP-out <= VFD.Operation_Signals.00

# external output signals

#OUTPUTS 00-15

# --- COOLANT-MIST ---
net coolant-mist     =>  hm2_7i76e.0.7i76.0.0.output-05

# --- COOLANT-FLOOD ---
net coolant-flood     =>  hm2_7i76e.0.7i76.0.0.output-06

# --- TOOL-PROBE-CLEAN ---
#not working yet, need relay change !!
net tool-probe-clean     =>  hm2_7i76e.0.7i76.0.0.output-07

#servo enable for ecodrive OUT

net x-enable     =>  hm2_7i76e.0.7i76.0.0.output-03

# external input signals

#INPUTS 00-31(-not)

#Spindle VFD Fault

net estopvfd not.0.in	<= V1000.0.DS2-Fault

#Spindle Temp Error
#net Spindle-Temp     <=  hm2_7i76e.0.7i76.0.0.input-28-not

#servo errors in
#in custom_postgui.hal


#PROBE IN
net probe-in     	<=  hm2_7i76e.0.7i76.0.0.input-30-not
#not connected !!!!!!!!!!!!
net probe-in-error    	<=  hm2_7i76e.0.7i76.0.0.input-29


#*******************
#  AXIS X
#*******************

setp   pid.x.Pgain     [AXIS_0]P
setp   pid.x.Igain     [AXIS_0]I
setp   pid.x.Dgain     [AXIS_0]D
setp   pid.x.bias      [AXIS_0]BIAS
setp   pid.x.FF0       [AXIS_0]FF0
setp   pid.x.FF1       [AXIS_0]FF1
setp   pid.x.FF2       [AXIS_0]FF2
setp   pid.x.deadband  [AXIS_0]DEADBAND
setp   pid.x.maxoutput [AXIS_0]MAX_OUTPUT
setp   pid.x.error-previous-target true
setp   pid.x.maxerror .0005

net x-index-enable  <=> pid.x.index-enable
net x-enable        =>  pid.x.enable
net x-pos-cmd       =>  pid.x.command
net x-vel-cmd       =>  pid.x.command-deriv
net x-pos-fb        =>  pid.x.feedback
net x-output        =>  pid.x.output

# Step Gen signals/setup

setp   hm2_7i76e.0.stepgen.00.dirsetup        [AXIS_0]DIRSETUP
setp   hm2_7i76e.0.stepgen.00.dirhold         [AXIS_0]DIRHOLD
setp   hm2_7i76e.0.stepgen.00.steplen         [AXIS_0]STEPLEN
setp   hm2_7i76e.0.stepgen.00.stepspace       [AXIS_0]STEPSPACE
setp   hm2_7i76e.0.stepgen.00.position-scale  [AXIS_0]STEP_SCALE
setp   hm2_7i76e.0.stepgen.00.step_type        0
setp   hm2_7i76e.0.stepgen.00.control-type     1
setp   hm2_7i76e.0.stepgen.00.maxaccel         [AXIS_0]STEPGEN_MAXACCEL
setp   hm2_7i76e.0.stepgen.00.maxvel           [AXIS_0]STEPGEN_MAXVEL

#dir
setp    hm2_7i76e.0.gpio.000.invert_output true
#step
#setp    hm2_7i76e.0.gpio.001.invert_output true

# ---closedloop stepper signals---

net x-pos-cmd    <= axis.0.motor-pos-cmd
net x-vel-cmd    <= axis.0.joint-vel-cmd
net x-output     <= hm2_7i76e.0.stepgen.00.velocity-cmd
net x-pos-fb     <= hm2_7i76e.0.stepgen.00.position-fb
net x-pos-fb     => axis.0.motor-pos-fb
net x-enable     <= axis.0.amp-enable-out
net x-enable     => hm2_7i76e.0.stepgen.00.enable

# ---setup home / limit switch signals---

net x-home-sw     =>  axis.0.home-sw-in
net x-neg-limit     =>  axis.0.neg-lim-sw-in
net x-pos-limit     =>  axis.0.pos-lim-sw-in

#*******************
#  AXIS Y
#*******************

setp   pid.y.Pgain     [AXIS_1]P
setp   pid.y.Igain     [AXIS_1]I
setp   pid.y.Dgain     [AXIS_1]D
setp   pid.y.bias      [AXIS_1]BIAS
setp   pid.y.FF0       [AXIS_1]FF0
setp   pid.y.FF1       [AXIS_1]FF1
setp   pid.y.FF2       [AXIS_1]FF2
setp   pid.y.deadband  [AXIS_1]DEADBAND
setp   pid.y.maxoutput [AXIS_1]MAX_OUTPUT
setp   pid.y.error-previous-target true
setp   pid.y.maxerror .0005

net y-index-enable  <=> pid.y.index-enable
net y-enable        =>  pid.y.enable
net y-pos-cmd       =>  pid.y.command
net y-vel-cmd       =>  pid.y.command-deriv
net y-pos-fb        =>  pid.y.feedback
net y-output        =>  pid.y.output

# Step Gen signals/setup

setp   hm2_7i76e.0.stepgen.01.dirsetup        [AXIS_1]DIRSETUP
setp   hm2_7i76e.0.stepgen.01.dirhold         [AXIS_1]DIRHOLD
setp   hm2_7i76e.0.stepgen.01.steplen         [AXIS_1]STEPLEN
setp   hm2_7i76e.0.stepgen.01.stepspace       [AXIS_1]STEPSPACE
setp   hm2_7i76e.0.stepgen.01.position-scale  [AXIS_1]STEP_SCALE
setp   hm2_7i76e.0.stepgen.01.step_type        0
setp   hm2_7i76e.0.stepgen.01.control-type     1
setp   hm2_7i76e.0.stepgen.01.maxaccel         [AXIS_1]STEPGEN_MAXACCEL
setp   hm2_7i76e.0.stepgen.01.maxvel           [AXIS_1]STEPGEN_MAXVEL

#dir YL
setp    hm2_7i76e.0.gpio.002.invert_output true

# ---closedloop stepper signals---

net y-pos-cmd    <= axis.1.motor-pos-cmd
net y-vel-cmd    <= axis.1.joint-vel-cmd
net y-output     <= hm2_7i76e.0.stepgen.01.velocity-cmd
net y-pos-fb     <= hm2_7i76e.0.stepgen.01.position-fb
net y-pos-fb     => axis.1.motor-pos-fb
net y-enable     <= axis.1.amp-enable-out
net y-enable     => hm2_7i76e.0.stepgen.01.enable


# Step Gen signals/setup for tandem axis stepper

setp   hm2_7i76e.0.stepgen.02.dirsetup        [AXIS_1]DIRSETUP
setp   hm2_7i76e.0.stepgen.02.dirhold         [AXIS_1]DIRHOLD
setp   hm2_7i76e.0.stepgen.02.steplen         [AXIS_1]STEPLEN
setp   hm2_7i76e.0.stepgen.02.stepspace       [AXIS_1]STEPSPACE
setp   hm2_7i76e.0.stepgen.02.position-scale  [AXIS_1]STEP_SCALE
setp   hm2_7i76e.0.stepgen.02.step_type        0
setp   hm2_7i76e.0.stepgen.02.control-type     0
setp   hm2_7i76e.0.stepgen.02.maxaccel         [AXIS_1]STEPGEN_MAXACCEL
setp   hm2_7i76e.0.stepgen.02.maxvel           [AXIS_1]STEPGEN_MAXVEL

net y2-pos-fb                            <=  hm2_7i76e.0.stepgen.02.position-fb
net y-pos-cmd                            =>  hm2_7i76e.0.stepgen.02.position-cmd
net y-enable                             =>  hm2_7i76e.0.stepgen.02.enable

#dir YR
setp    hm2_7i76e.0.gpio.004.invert_output true

# ---setup home / limit switch signals---

net y-home-sw     =>  axis.1.home-sw-in
net y-neg-limit     =>  axis.1.neg-lim-sw-in
net y-pos-limit     =>  axis.1.pos-lim-sw-in



#*******************
#  AXIS Z
#*******************

setp   pid.z.Pgain     [AXIS_2]P
setp   pid.z.Igain     [AXIS_2]I
setp   pid.z.Dgain     [AXIS_2]D
setp   pid.z.bias      [AXIS_2]BIAS
setp   pid.z.FF0       [AXIS_2]FF0
setp   pid.z.FF1       [AXIS_2]FF1
setp   pid.z.FF2       [AXIS_2]FF2
setp   pid.z.deadband  [AXIS_2]DEADBAND
setp   pid.z.maxoutput [AXIS_2]MAX_OUTPUT
setp   pid.z.error-previous-target true
setp   pid.z.maxerror .0005

net z-index-enable  <=> pid.z.index-enable
net z-enable        =>  pid.z.enable
net z-pos-cmd       =>  pid.z.command
net z-vel-cmd       =>  pid.z.command-deriv
net z-pos-fb        =>  pid.z.feedback
net z-output        =>  pid.z.output

# Step Gen signals/setup

setp   hm2_7i76e.0.stepgen.03.dirsetup        [AXIS_2]DIRSETUP
setp   hm2_7i76e.0.stepgen.03.dirhold         [AXIS_2]DIRHOLD
setp   hm2_7i76e.0.stepgen.03.steplen         [AXIS_2]STEPLEN
setp   hm2_7i76e.0.stepgen.03.stepspace       [AXIS_2]STEPSPACE
setp   hm2_7i76e.0.stepgen.03.position-scale  [AXIS_2]STEP_SCALE
setp   hm2_7i76e.0.stepgen.03.step_type        0
setp   hm2_7i76e.0.stepgen.03.control-type     1
setp   hm2_7i76e.0.stepgen.03.maxaccel         [AXIS_2]STEPGEN_MAXACCEL
setp   hm2_7i76e.0.stepgen.03.maxvel           [AXIS_2]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net z-pos-cmd    <= axis.2.motor-pos-cmd
net z-vel-cmd    <= axis.2.joint-vel-cmd
net z-output     <= hm2_7i76e.0.stepgen.03.velocity-cmd
net z-pos-fb     <= hm2_7i76e.0.stepgen.03.position-fb
net z-pos-fb     => axis.2.motor-pos-fb
net z-enable     <= axis.2.amp-enable-out
net z-enable     => hm2_7i76e.0.stepgen.03.enable

# ---setup home / limit switch signals---

net z-home-sw     =>  axis.2.home-sw-in
net z-neg-limit     =>  axis.2.neg-lim-sw-in
net z-pos-limit     =>  axis.2.pos-lim-sw-in


#dir
setp    hm2_7i76e.0.gpio.006.invert_output true


#*******************
#  SPINDLE S
#*******************

setp   pid.s.Pgain     [SPINDLE_9]P
setp   pid.s.Igain     [SPINDLE_9]I
setp   pid.s.Dgain     [SPINDLE_9]D
setp   pid.s.bias      [SPINDLE_9]BIAS
setp   pid.s.FF0       [SPINDLE_9]FF0
setp   pid.s.FF1       [SPINDLE_9]FF1
setp   pid.s.FF2       [SPINDLE_9]FF2
setp   pid.s.deadband  [SPINDLE_9]DEADBAND
setp   pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT
setp   pid.s.error-previous-target true

net -index-enable  <=> pid.s.index-enable
net spindle-enable        =>  pid.s.enable
net spindle-vel-cmd-rpm     => pid.s.command
net spindle-vel-fb-rpm      => pid.s.feedback
net spindle-output        <=  pid.s.output

# vfd limit

setp limit1.0.min 0
setp limit1.0.max 24000

net VFDLOUT limit1.0.out => VFD.Frequency_Reference_IN.00

# ---setup spindle control signals---

net spindle-vel-cmd-rps        <=  motion.spindle-speed-out-rps
net spindle-vel-cmd-rps-abs    <=  motion.spindle-speed-out-rps-abs
net spindle-vel-cmd-rpm        <=  motion.spindle-speed-out 		
net spindle-vel-cmd-rpm-abs    <=  motion.spindle-speed-out-abs		=> limit1.0.in
net spindle-enable             <=  motion.spindle-on			=> V1000.0.OP-Run
net spindle-cw                 <=  motion.spindle-forward
net spindle-ccw                <=  motion.spindle-reverse
net spindle-brake              <=  motion.spindle-brake
net spindle-revs               =>  motion.spindle-revs
net spindle-at-speed           =>  motion.spindle-at-speed		<= V1000.0.DS2-Speed-Agree
net spindle-vel-fb-rps         =>  motion.spindle-speed-in
net spindle-index-enable      <=>  motion.spindle-index-enable


#  ---coolant signals---

net coolant-mist      <=  iocontrol.0.coolant-mist
net coolant-flood     <=  iocontrol.0.coolant-flood

#  ---probe signal---

net probe-in     =>  motion.probe-input

#  ---motion control signals---

net in-position               <=  motion.in-position
net machine-is-enabled        <=  motion.motion-enabled

#  ---digital in / out signals---

#  ---estop signals---

net estop-out     <=  iocontrol.0.user-enable-out
net estop-ext     =>  iocontrol.0.emc-enable-in

#  ---manual tool change signals---

loadusr -W hal_manualtoolchange
net tool-change-request     iocontrol.0.tool-change       =>  hal_manualtoolchange.change
net tool-change-confirmed   iocontrol.0.tool-changed      <=  hal_manualtoolchange.changed
net tool-number             iocontrol.0.tool-prep-number  =>  hal_manualtoolchange.number
net tool-prepare-loopback   iocontrol.0.tool-prepare      =>  iocontrol.0.tool-prepared

# **** Kofiguracja dla zewnętrznego programu PLC dla homing ecodr3 -START ****

#IN <=

#in from ecodrive
#in_reference signal
#in custom_postgui.hal

net HOMED_X 		 	classicladder.0.in-06 <= axis.0.homed
net HOMED_Y 		 	classicladder.0.in-07 <= axis.1.homed
net HOMED_Z 		 	classicladder.0.in-08 <= axis.2.homed

#OUT =>

net HOME_X_HAL 	 		classicladder.0.out-04 => halui.joint.0.home
net HOME_Y_HAL 	 		classicladder.0.out-05 => halui.joint.1.home
net HOME_Z_HAL 	 		classicladder.0.out-06 => halui.joint.2.home

#homing signal =>

net HOME_X_OUT 		 	classicladder.0.out-00 => hm2_7i76e.0.7i76.0.0.output-01
net HOME_Y_OUT 		 	classicladder.0.out-01 => hm2_7i76e.0.7i76.0.0.output-02
net HOME_Z_OUT 		 	classicladder.0.out-03 => hm2_7i76e.0.7i76.0.0.output-00

#Clear Error signal =>

net CLR_ERROR_OUT 		 	classicladder.0.out-09 => hm2_7i76e.0.7i76.0.0.output-04


# **** Kofiguracja dla zewnętrznego programu PLC dla homing ecodr3 -END ****

# Uruchom Classicladder bez GUI (można prezładować PLC GUI w AXIS GUI

loadusr classicladder --nogui homing_ecodr3.clp

# ************** External Buttons *****************

net hal-is-running Dupl.0.in <= halui.program.is-running
net hal-is-paused Dupl.1.in <= halui.program.is-paused
net hal-is-idle Dupl.2.in <= halui.program.is-idle

# Pause/Resume Section
net pause-resume-btn and2.0.in0 and2.1.in0 <= hm2_7i76e.0.7i76.0.0.input-17-not
net pause-on toggle2nist.0.is-on and2.0.in1 and2.3.in1 <= Dupl.1.out0
net run-on and2.1.in1 <= Dupl.0.out0
net pause-sig or2.0.in0 <= and2.0.out
net resume-sig or2.0.in1 <= and2.1.out
net toggle-ok toggle.0.in <= or2.0.out
net togglesig toggle2nist.0.in <= toggle.0.out

net toggleon-or-in0 or2.5.in0 <= toggle2nist.0.on
net toggleoff-or-in0 or2.6.in0 <= toggle2nist.0.off
net toggleon halui.program.pause <= or2.5.out
net toggleoff halui.program.resume <= or2.6.out

# Run/Step Section
net run-step-btn and2.2.in0 and2.3.in0 <= hm2_7i76e.0.7i76.0.0.input-16-not
net idle-on and2.2.in1 <= Dupl.2.out0
net run-sig-or-in0 or2.4.in0 <= and2.2.out
net run-sig halui.mode.auto halui.program.run <= or2.4.out
net step-sig-or-in0 or2.3.in0  <= and2.3.out
net step-sig halui.program.step <= or2.3.out

# Stop Section
net stop-btn and2.4.in0 <= hm2_7i76e.0.7i76.0.0.input-18-not
net run-on and2.4.in1 <= Dupl.0.out0
net stop-sig-or-in0 or2.2.in0 <= and2.4.out
net stop-sig halui.program.stop <= or2.2.out

# E-stop Section 

net e-stop-btn => logic.0.in-00 <= hm2_7i76e.0.7i76.0.0.input-31
net spindle-temp-error => logic.0.in-01 <= hm2_7i76e.0.7i76.0.0.input-28
net vfd-error => logic.0.in-02 <= not.0.out
net estop-ext <= logic.0.and

# Tool IN button Section

net tool-in-btn => or2.1.in0 <= hm2_7i76e.0.7i76.0.0.input-20-not
net tool-in-sig => hal_manualtoolchange.change_button <= or2.1.out

# Safe-Z button Section

net Safe-Z-Btn => halui.mdi-command-11 <= hm2_7i76e.0.7i76.0.0.input-19-not

# Go to Zero button Section

net Go-to-0-Btn => halui.mdi-command-16 <= hm2_7i76e.0.7i76.0.0.input-21-not

# Home button

net home-sig-or-in0 or2.7.in0  <= hm2_7i76e.0.7i76.0.0.input-22
net home-sig and2.5.in0 <= or2.7.out
 
net home-on-sig-in and2.5.in1 <= Dupl.3.out0
net home-on-sig classicladder.0.in-05 <= and2.5.out
net hal-machine-is-on Dupl.3.in <= halui.machine.is-on

custom_postgui

Kod: Zaznacz cały

# Tutaj dodaj swoje polecenia HAL
# Polecenia w tym pliku są wykonywane po uruchomieniu AXIS GUI (włączając panel PyVCP)

# **** Konfiguracja wyświetlania prędkości wrzeciona w pyVCP - START ****
# **** Używaj ZADANEJ prędkości wrzeciona z LinuxCNC ponieważ nie jest zdefiniowany enkoder wrzeciona

#SPINDLE STATUS

net spindle-CE => Pasek_Statusu.VFD-CE <= V1000.0.FC1-CE
net RPM_BAR => VFD.Output_Frequency_RPM.00.float <= Pasek_Statusu.Spindle_Speed_Bar
net TORQUE_BAR => VFD.Output_Power.00.float <= Pasek_Statusu.Spindle_Power_Bar
net CLEAR_ERROR_VFD => V1000.0.OP-Fault-Reset <= Pasek_Statusu.CLEAR_ERROR_VFD
net Spindle-Temp     <=  hm2_7i76e.0.7i76.0.0.input-28-not => Pasek_Statusu.Spindle-Temp

#HOMING

net HOME_ALL_ECO => and2.6.in0 <= Pasek_Statusu.HOME_ALL_ECO_BUTTON
net HOME_ALL_ECO-sig-in and2.6.in1 <= Dupl.3.out1
net HOME_ALL_ECO-sig classicladder.0.in-00 <= and2.6.out


net HOME_InRef_X 		classicladder.0.in-01 <= hm2_7i76e.0.7i76.0.0.input-04 => Pasek_Statusu.Homing_Status_X
net HOME_InRef_YL 	 	classicladder.0.in-02 <= hm2_7i76e.0.7i76.0.0.input-05 => Pasek_Statusu.Homing_Status_YL
net HOME_InRef_YR 	 	classicladder.0.in-03 <= hm2_7i76e.0.7i76.0.0.input-06 => Pasek_Statusu.Homing_Status_YR
net HOME_InRef_Z 	 	classicladder.0.in-04 <= hm2_7i76e.0.7i76.0.0.input-07 => Pasek_Statusu.Homing_Status_Z

#TORQUE METER

net TorqueX-analogue hm2_7i76e.0.7i76.0.0.analogin0 => torqueX-scale.in
net torqueX-override torqueX-scale.out  => Pasek_Statusu.Torque_X_bar
setp torqueX-scale.gain 15

net TorqueYL-analogue hm2_7i76e.0.7i76.0.0.analogin1 => torqueYL-scale.in
net torqueYL-override torqueYL-scale.out  => Pasek_Statusu.Torque_YL_bar
setp torqueYL-scale.gain 15

net TorqueYR-analogue hm2_7i76e.0.7i76.0.0.analogin2 => torqueYR-scale.in
net torqueYR-override torqueYR-scale.out  => Pasek_Statusu.Torque_YR_bar
setp torqueYR-scale.gain 15

net TorqueZ-analogue hm2_7i76e.0.7i76.0.0.analogin3 => torqueZ-scale.in
net torqueZ-override torqueZ-scale.out  => Pasek_Statusu.Torque_Z_bar
setp torqueZ-scale.gain 15



#CLEAR ERROR

net  CLEAR_ERROR_ECO => classicladder.0.in-09 <= Pasek_Statusu.CLEAR_ERROR_ECO_BUTTON

#ERROR STATUS 

net fault-X => axis.0.amp-fault-in classicladder.0.in-10 Pasek_Statusu.axe_X_status <= hm2_7i76e.0.7i76.0.0.input-08-not
net fault-Y  => axis.1.amp-fault-in classicladder.0.out-14
net fault-YL => classicladder.0.in-11 Pasek_Statusu.axe_YL_status <= hm2_7i76e.0.7i76.0.0.input-09-not
net fault-YR => classicladder.0.in-13 Pasek_Statusu.axe_YR_status <= hm2_7i76e.0.7i76.0.0.input-10-not
net fault-Z => axis.2.amp-fault-in Pasek_Statusu.axe_Z_status classicladder.0.in-12 <= hm2_7i76e.0.7i76.0.0.input-11-not



Awatar użytkownika

Autor tematu
adam Fx
Lider FORUM (min. 2000)
Lider FORUM (min. 2000)
Posty w temacie: 7
Posty: 5562
Rejestracja: 04 lip 2004, 16:03
Lokalizacja: Gliwice

Re: Uaktualnienie LinuxCNC - MB2HAL - pliki w C jak to zrobić?

#10

Post napisał: adam Fx » 13 maja 2019, 02:25

Dzięki trochę nad tym posiedziałem ale za słabo znam hal bo gubię trop:

np.
[TRANSACTION_07]
MB_TX_CODE=fnct_16_write_multiple_registers
HAL_TX_NAME=Frequency_Reference_IN
FIRST_ELEMENT=2
NELEMENTS=1
MAX_UPDATE_RATE=0.0
DEBUG=0

jest wywołana

net VFDLOUT limit1.0.out => VFD.Frequency_Reference_IN.00
i tu trop się urywa - brak mi związku z tym co podajemy w g kodzie np. M3 S1000 (tu pewnie jakaś zamiana może obliczenia na częstotliwość) i powiązanie z VFDLOUT limit1.out

Naprowadziłeś mnie z tą wersją 2,8 - faktycznie zaktualizowałem ( krok po kroku jak zaktualizować https://forum.linuxcnc.org/38-general-l ... dating-2-8 )
Jestem blisko ale nadal mam błędy (chyba wynikające z różnic w jego hal głównym a moim albo z samej wersji rozwojowej Linuxcnc)

dla tego Jeszce chcę pójść tropem Twojego config opartego na NELEMENST
sorki za wszystkie błędy ... (dyslektyk) :?
Zobacz moje filmy http://www.youtube.com/user/pokachontass/videos

ODPOWIEDZ Poprzedni tematNastępny temat

Wróć do „LinuxCNC (dawniej EMC2)”