Forum: Projekte & Code Software Profibus DP-Slave in C


Announcement: there is an English version of this forum on EmbDev.net. Posts you create there will be displayed on Mikrocontroller.net and EmbDev.net.
von Amigo I. (Firma: hobby) (sony2019)


Lesenswert?

OK I has been done with UNO based on code from Tadej, I think it's same 
with NANO setup.
I only change in serial setup from serial2 to serial0.
I has been followed this topic since November 2013 and beginning to try 
again a few month ago.

Thank you for everything.

: Bearbeitet durch User
von Tadej S. (tadythefish)


Lesenswert?

I'm sorry for the late reply. Did you manage to make it work? If not I 
can also post code for the UNO/Nano version.
I made it work with a Nano (MEGA328) and 5 i2c PWM output expanders. I 
have been testing this slave for 3 months now with no profibus errors. 
It works great but only goes up to 45.45k speed
Anyway those 5 PWM expander provide 48 PWM outputs!

von Amigo I. (Firma: hobby) (sony2019)


Lesenswert?

Hallo,
It is great. I also test with DS18B20 temperature sensor.
Now I still test to ATMega32 based arduino MIGHTYCORE but not success 
yet.
@Tadej if you have code is wellcome.

Regards

von Yuriy (Gast)


Lesenswert?

Michael schrieb:
> Dear mr. Jörg S!
> Many thanks for such an excellent implementation of the Profibus DP
> software slave. With minor changes, on the Cortex-M0 I achieved a stable
> exchange rate of 3Mb / sec. Thanks again for such a wonderful job!
> Best Regards, Michael.

Michael, can you share the code?

von Rico S. (ridchi1980)


Lesenswert?

Tadej S. schrieb:
> Hello!
>
> I would like to share my adaption of your software to Arduino MEGA2560
> Hope it helps someone!

Hello TadyTheFish,

I use a Controllino Mega and would like to use your implementation.
https://www.controllino.biz/wp-content/uploads/2018/10/CONTROLLINO-MEGA-Pinout.pdf

In the Controllino is an SN65HVD08, which should actually work the same 
way.
Your code contains a lot of assembler, which I cannot.

Can you rewrite me your code that I can work with RX3-TX3 instead of 
RX2-TX2.

Thanks.
Ridchi

von Amigo I. (Firma: hobby) (sony2019)


Lesenswert?

If still use the same controller with Arduino mega maybe you just change 
the register related serial3 and also consider the working clock for the 
CPU. In uno / nano I just change the register serial2 to serial0 from 
Tadej's code. You can read the Atmega2560 datasheet to find the 
register.

von Tadej S. (tadythefish)


Angehängte Dateien:

Lesenswert?

Hello

Sorry for the late reply. I have editedd the programs and made 3 
versions.

Mega2560 UART2
Mega2560 UART3
Mega328

I have not tested the UART3 version so please if it works leave reply or 
if it dos not :)

EDIT: Whoops.. both attachements are the same :D

: Bearbeitet durch User
von Amigo I. (Firma: hobby) (sony2019)


Lesenswert?

Hi Tadej,
Do you have try the ATMega16 or ATMega32? Please share the code.

Thank you in advance

von Tadej S. (tadythefish)


Lesenswert?

Sorry I don't. I work with arduino IDE and those chips are not included 
by default and I never had a need for them. You could addopt the code to 
work with those chips but you need to find the registers for UART and 
Timer and change them to suite those chips

von Rico S. (ridchi1980)


Lesenswert?

Thanks Tadej,

i will test it.

Ridchi

von Rico S. (ridchi1980)


Lesenswert?

Tadej S. schrieb:
> Hello
>
> Sorry for the late reply. I have editedd the programs and made 3
> versions.
>
> Mega2560 UART2
> Mega2560 UART3
> Mega328
>
> I have not tested the UART3 version so please if it works leave reply or
> if it dos not :)
>
> EDIT: Whoops.. both attachements are the same :D

Hello Tadej,

i have test the Mega2560 UART3.
You have forgotten to change in row 853:
1
UCSR2B |= _BV(UDRIE2);  // <<< AVR Version

into
1
UCSR3B |= _BV(UDRIE3);  // <<< AVR Version

then it works.


But I get a lot of warnings when compiling.
The Problem is the conversion from unsigned char* into char*

for example:
1
if (checksum(&uart_buffer[1], 3) != FCS_data) break;

you must write for correctly syntax
1
if (checksum((char*)&uart_buffer[1], 3) != FCS_data) break;

;-)


Currently my Profibus connection works with 93750baud without problems.

Thanks.


PS:  Why did you insert an offset (+5) in uart_buffer?

: Bearbeitet durch User
von Tadej S. (tadythefish)


Lesenswert?

Hmm thank you for your input.. Maybe you could upload the corrected 
version?
I'm sorry so much things to do and so little time. I remember this 
problem the IDE was failing to compile the original version when I was 
"porting" the code.
Anyway the mega328 version is running on my friends test bench for 3 
months and 2 day till today...
Maybe I forgot to change this in the mega2560 code I don't know I didn't 
really gave much attention since it works for my friend
But it works with 45.45k. I can't remember seeing the baudrate you have 
specified in WinCC or TIA portal.. But I am not really the PLC 
programming guy. I just helped my friend that is a Simatic guru ?

von Tadej S. (tadythefish)


Lesenswert?

I just found out that why the code compiled properly on my IDE..
Compiler warnings were turned off :) thabk you so much.

I have corrected the registers that you have pointed out. Yes I have 
changed on the bottom and I missed the TX routine that needed changing ?

As I said its been 3 month since I last saw the code ?

The +5 is not an offset i expanded the buffer because I had problems and 
I couldn't find what was wrong. The program was crashin so I tought that 
maybe the program goes out of bounds somwhere but in the end there was a 
problem with a poor profibus connection.. You can remove the +5 it 
should work the same.. Or you can leave it there is more than enough 
space

: Bearbeitet durch User
von Amigo I. (Firma: hobby) (sony2019)


Lesenswert?

Tadej S. schrieb:
> Sorry I don't. I work with arduino IDE and those chips are not included
> by default and I never had a need for them. You could addopt the code to
> work with those chips but you need to find the registers for UART and
> Timer and change them to suite those chips

Maybe you can try to add the hardware ATmega16 or 32 from mightycore 
https://github.com/MCUdude/MightyCore

I just have problem in how to compile from your code (Arduino mega) to 
mega32 controller. It's many error that I do not understand. If you can 
compile without error I can try to the my hardware hardware.

von Peter (Gast)


Lesenswert?

Hi Guys.
I saw that there are already M0 ports.
Would be nice if the code were published here.

von M@tti@ (Gast)


Lesenswert?

Hi at all, anybody have an example to read an digital input on the 
Arduino and write in the PLC and viceversa?

Many thanks at all

M@tti@

von Amigo I. (Firma: hobby) (sony2019)


Lesenswert?

M@tti@ schrieb:
> Hi at all, anybody have an example to read an digital input on the
> Arduino and write in the PLC and viceversa?
>
> Many thanks at all
>
> M@tti@

Tadej's code have io access.

von Amigo I. (Firma: hobby) (sony2019)


Lesenswert?

Try to compile with ATMega32 mightycore to many error like below:

########################################################################
Arduino: 1.8.5 (Windows 10), Board: "ATmega32, Standard, 2.7v, Disabled 
(default), 16 MHz external"

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino: In function 'void 
profibus_RX()':

profibus_M32_1.ino:154: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

         if (checksum(&uart_buffer[1], 3) != FCS_data) break;

                                        ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:708:15: note: 
initializing argument 1 of 'unsigned char checksum(char*, unsigned 
char)'

 unsigned char checksum(char *data, unsigned char length)

               ^

profibus_M32_1.ino:171: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

         if (checksum(&uart_buffer[4], PDU_size) != FCS_data) break;

                                               ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:708:15: note: 
initializing argument 1 of 'unsigned char checksum(char*, unsigned 
char)'

 unsigned char checksum(char *data, unsigned char length)

               ^

profibus_M32_1.ino:188: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

         if (checksum(&uart_buffer[1], 8) != FCS_data) break;

                                        ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:708:15: note: 
initializing argument 1 of 'unsigned char checksum(char*, unsigned 
char)'

 unsigned char checksum(char *data, unsigned char length)

               ^

profibus_M32_1.ino:245: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

             profibus_send_CMD(SC, 0, SAP_OFFSET, &uart_buffer[0], 0);

                                                                    ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:596:6: note: 
initializing argument 4 of 'void profibus_send_CMD(unsigned char, 
unsigned char, unsigned char, char*, unsigned char)'

 void profibus_send_CMD (unsigned char type,

      ^

profibus_M32_1.ino:320: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

               profibus_send_CMD(SD2, DATA_LOW, SAP_OFFSET, 
&uart_buffer[7], 8 + EXT_DIAG_DATA_SIZE);

                                                                                                   ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:596:6: note: 
initializing argument 4 of 'void profibus_send_CMD(unsigned char, 
unsigned char, unsigned char, char*, unsigned char)'

 void profibus_send_CMD (unsigned char type,

      ^

profibus_M32_1.ino:349: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

               profibus_send_CMD(SD2, DATA_LOW, SAP_OFFSET, 
&uart_buffer[7], 8 + EXT_DIAG_DATA_SIZE);

                                                                                                   ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:596:6: note: 
initializing argument 4 of 'void profibus_send_CMD(unsigned char, 
unsigned char, unsigned char, char*, unsigned char)'

 void profibus_send_CMD (unsigned char type,

      ^

profibus_M32_1.ino:390: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

               profibus_send_CMD(SC, 0, SAP_OFFSET, &uart_buffer[0], 0);

                                                                      ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:596:6: note: 
initializing argument 4 of 'void profibus_send_CMD(unsigned char, 
unsigned char, unsigned char, char*, unsigned char)'

 void profibus_send_CMD (unsigned char type,

      ^

profibus_M32_1.ino:523: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

             profibus_send_CMD(SC, 0, SAP_OFFSET, &uart_buffer[0], 0);

                                                                    ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:596:6: note: 
initializing argument 4 of 'void profibus_send_CMD(unsigned char, 
unsigned char, unsigned char, char*, unsigned char)'

 void profibus_send_CMD (unsigned char type,

      ^

profibus_M32_1.ino:543: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

         profibus_send_CMD(SD1, FDL_STATUS_OK, 0, &uart_buffer[0], 0);

                                                                    ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:596:6: note: 
initializing argument 4 of 'void profibus_send_CMD(unsigned char, 
unsigned char, unsigned char, char*, unsigned char)'

 void profibus_send_CMD (unsigned char type,

      ^

profibus_M32_1.ino:571: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

           profibus_send_CMD(SD2, DIAGNOSE, 0, &uart_buffer[7], 0);  // 
Request a diagnosis

                                                                 ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:596:6: note: 
initializing argument 4 of 'void profibus_send_CMD(unsigned char, 
unsigned char, unsigned char, char*, unsigned char)'

 void profibus_send_CMD (unsigned char type,

      ^

profibus_M32_1.ino:573: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

           profibus_send_CMD(SD2, DATA_LOW, 0, &uart_buffer[7], 
Input_Data_size);  // send data

                                                                               ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:596:6: note: 
initializing argument 4 of 'void profibus_send_CMD(unsigned char, 
unsigned char, unsigned char, char*, unsigned char)'

 void profibus_send_CMD (unsigned char type,

      ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino: In function 'void 
profibus_send_CMD(unsigned char, unsigned char, unsigned char, char*, 
unsigned char)':

profibus_M32_1.ino:613: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

       uart_buffer[4] = checksum(&uart_buffer[1], 3);

                                                   ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:708:15: note: 
initializing argument 1 of 'unsigned char checksum(char*, unsigned 
char)'

 unsigned char checksum(char *data, unsigned char length)

               ^

profibus_M32_1.ino:632: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

       uart_buffer[7+length_pdu] = checksum(&uart_buffer[4], length_pdu 
+ 3);

                                                                           ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:708:15: note: 
initializing argument 1 of 'unsigned char checksum(char*, unsigned 
char)'

 unsigned char checksum(char *data, unsigned char length)

               ^

profibus_M32_1.ino:648: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

       uart_buffer[9] = checksum(&uart_buffer[4], 8);

                                                   ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:708:15: note: 
initializing argument 1 of 'unsigned char checksum(char*, unsigned 
char)'

 unsigned char checksum(char *data, unsigned char length)

               ^

profibus_M32_1.ino:678: error: invalid conversion from 'unsigned char*' 
to 'char*' [-fpermissive]

   profibus_TX(&uart_buffer[0], length_data);

                                           ^

C:\M32\profibus_M32_1.ino\profibus_M32_1.ino.ino:689:6: note: 
initializing argument 1 of 'void profibus_TX(char*, unsigned char)'

 void profibus_TX (char *data, unsigned char length)

      ^

exit status 1
invalid conversion from 'unsigned char*' to 'char*' [-fpermissive]

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

########################################################################
how to solve?

: Bearbeitet durch User
von Rico S. (ridchi1980)


Lesenswert?

you must write for correctly syntax

if (checksum((char*)&uart_buffer[1], 3) != FCS_data) break;

!!!!!!!!

The same with the other line with Checksum ()

Ridchi

von Amigo I. (Firma: hobby) (sony2019)


Lesenswert?

Hi Ridchi,
The code is compile without error in UNO, NANO and MEGA. What is wrong 
in arduino mightycore?

von Tadej S. (tadythefish)


Lesenswert?

The errors you posted should actually be warnings.
The problem is with registers. Mega32 uses completely different 
registers then a meva328 or 2560 uses. The code needs alot of adapting 
to run on an mega32.

Why don't you upgrade to a different MCU?

von M@tti@ (Gast)


Lesenswert?

Hi @Amigo I., and many thanks for the reply.
I tried the Tadej S. code, but without result, in the PC i don't see the 
state of the digital input (for example Arduino pin 4) change.
How is mapped this digital input (pin 4) of Arduino in the PLC?
In the Hardware Configuration (Step7) i have make for first an Universal 
Module, for second 1 byte Input and for third 1 byte Output. It's ok 
this configuration?
Do you have an example or a screenshot of your project that works?

Thank you very much

M @ TTI @

von Rico S. (ridchi1980)


Lesenswert?

You must Write the state of Pin4 as Bit0 in data_out_register[0] then 
you can used this in PLC I1.0 ect... The input Adress is this who 
configured it in Hardwareconfig.

von Amigo I. (Firma: hobby) (sony2019)


Lesenswert?

Tadej S. schrieb:
> The errors you posted should actually be warnings.
> The problem is with registers. Mega32 uses completely different
> registers then a meva328 or 2560 uses. The code needs alot of adapting
> to run on an mega32.
>

Hi Tadej,
I already change the Mega32 register, no error found related register. 
Only the error: invalid conversion from 'unsigned char*'
to 'char*' [-fpermissive] too many appear. I thing it's not hardware 
setting but about format to write. I not to much familiar with C.

> Why don't you upgrade to a different MCU?
Because I have few of Mega16 / Mega32 :)

thank

von Amigo I. (Firma: hobby) (sony2019)


Angehängte Dateien:

Lesenswert?

M@tti@ schrieb:
> Hi @Amigo I., and many thanks for the reply.
> I tried the Tadej S. code, but without result, in the PC i don't see the
> state of the digital input (for example Arduino pin 4) change.
> How is mapped this digital input (pin 4) of Arduino in the PLC?
> In the Hardware Configuration (Step7) i have make for first an Universal
> Module, for second 1 byte Input and for third 1 byte Output. It's ok
> this configuration?
> Do you have an example or a screenshot of your project that works?
>
> Thank you very much
>
> M @ TTI @

You can play the variable "data_in_register" and "data_out_register" 
related the I/O in "doit" routine.
In Simatic you can see in variable table.

von Vital K. (Firma: UMMC) (vital_k)


Lesenswert?

Michael schrieb:
> Dear mr. Jörg S!
> Many thanks for such an excellent implementation of the Profibus DP
> software slave. With minor changes, on the Cortex-M0 I achieved a stable
> exchange rate of 3Mb / sec. Thanks again for such a wonderful job!
> Best Regards, Michael.


and what RS485-UART chip did you get in contact with at 1.5Mb/s?

von Vital K. (Firma: UMMC) (vital_k)


Lesenswert?

Peter F. schrieb:
> Hello,
>
> I changed code from project AVRSoftBus for atXmega32A4U. It's run on
> 48Mhz. I tested both speed 187500 and 1M5, everything work. In
> profibus.h need change UART_BAUD and DELAY_TBIT. I used USART D0. I
> believe this code is usable for someone.


Hello, and what RS485-UART chip did you get in contact with at 1.5Mb / 
s?

von Bastler (Gast)


Lesenswert?

I have used the MAX1487 for 1,5 MBit/s.

von Piotr (Gast)


Lesenswert?

Hello,
I trying this code with ATmega2560 & 9.6kbps. My PLC always send 0x6D as 
function code.

Received byte: 68 5 5 68 C0 82 6D 3C 3E 29 16
Arduino send: 68 B B 68 FFFFFF82 FFFFFFC0 8 3E 3C 2 5 0 FFFFFFFF 
FFFFFFC0 FFFFFFDE 68 16

Adresses:
PLC 2, Arduino 64.

Please, advise me.

von Piotr (Gast)


Lesenswert?

I found the issue, my transmitter was broken. I test it as Ethernet/IP 
(Devicenet) - Profibus gate. May be  I make a success of my 3 years 
work.

von Jörg S. (joerg-s)


Lesenswert?

It is nice to see the Code is still alive! It gives me a good feeling :)

von Tadej S. (tadythefish)


Lesenswert?

Yes and we have all of you to thank! I ported the code to arduino and 
now i ported it to STM32F405. I got a stable connection at 6Mbits
Only now that i have worked with your code I understand the bus. So 
thank you again

von Torsten M. (Gast)


Lesenswert?

Hallo,
es ist zwar schon etwas älter hoffe aber trotzdem auf Hilfe.
Ich beschäftige mich gerade mit diesem Thema und habe da ein paar 
„kleine“ Probleme bei diesem Programm.
Zum Einsatz kommt eine S7-315-2DP und einen Atmega16
Die Dateien in meinem Programm sind vom 28.4.2010 (hoffe das es die 
aktuellste Version ist)

Die Funktion
1
slave_addr = get_Address();

Gibt es diese oder muss man die wenn nötig selbst erstellen?

1
//////////////////////////////////////////////////////////////////////////
2
void main (void)
3
{
4
5
  ///////////////////////////////////////
6
  //watchdog_aus          ();
7
  //init_MCU              ();
8
  //switch_SMCLK_XT1_8MHz ();
9
  init_UART0            ();
10
  init_Profibus         ();
11
  //interrupt_settings    ();
12
  ///////////////////////////////////////
13
14
  while(1)
15
  {
16
    // Hier Code fuer Hauptprogramm
17
  }
18
}
19
/////////////////////////////////////////////////////////////////////////

Die Auskommentierten Zeilen sind nicht in der .c bzw .h Datei enthalten, 
werden diese Benötigt?

Wie genau kann ich jetzt dann Daten Senden oder Empfangen… stehe 
irgendwie gerade auf dem Schlauch.

1
profibus_send_CMD(SD2, DIAGNOSE, 0, &uart_buffer[7], OUTPUT_DATA_SIZE);
Kann ich hiermit Daten schon senden wenn sie im uart_buffer stehen??


Schon mal danke für die Hilfe im vorraus.

Mfg
Torsten

von Bastler (Gast)


Lesenswert?

Hallo,
die Funktion "get_Address()" muss man sich schon selber schreiben.
Es weiß ja sonst keiner wo und wie die Adresseingabe erfolgt.

Ich habe bei einem Prokekt über ein 74HC166 eingelesen, bei einem 
anderen Projekt direkt über die GPIOs.

>Die Auskommentierten Zeilen sind nicht in der .c bzw .h Datei enthalten,
>werden diese Benötigt?
Deine GPIOs, UARTs, Timer, etc musst du schon initialisieren.
Je nach MCU verschieden.

>Kann ich hiermit Daten schon senden wenn sie im uart_buffer stehen??
Ich würde sagen ja.

Tipp:
Bau dir einen RS485->RS232 Sniffer, dann kannst du mit hterm die Daten 
in Hex ansehen. Hat mir öfters geholfen.

von Torsten M. (Gast)


Lesenswert?

Hallo,

dank für die Antwort.
Dann habe ich das soweit verstanden und werde mal schauen das ich das 
jetzt zum Laufen bekommen.

Das mit dem Sniffer ist kein schlechter Vorschlag, wird ich mich mal 
einen Bauen.

von Crk (Gast)


Lesenswert?

Hello, nice job!
I'm using this code to play with industrial items,
everything works until i add "liquidcrystal" library,
it does the setup, but when in the "loop"
the LCD goes back to reset.
Does Timer or Uart affects its usage?
Thank you

von Crk (Gast)


Angehängte Dateien:

Lesenswert?

I attach here my code

von Torsten M. (Gast)


Angehängte Dateien:

Lesenswert?

Hallo,

ich beschäftig ich jetzt schon etwas länger mit dem Thema und bekomme 
das nicht zum laufen... habe einen sehr einfachen Code genommen soll nur 
etwas Senden.

Als Vorlage habe ich die Bibliothek verwende wo schon vorhanden ist 
(9.2009 (Aktueller Stand)).
Als Übertragungsgeschwindigkeit habe ich auf dem Mikrocontroller sowie 
im TIA Portal 45,45 kBit/s eingestllet (Im TIA Portal bringt er bei den 
anderen Fehlermeldungen.
1
int main (void)
2
{
3
  //Ausgänge
4
  E_A = 0xFF;
5
6
  Profibus_Init();
7
  init_UART0();
8
  
9
//***while Schleife************************************************************************************************************************
10
  while(1)
11
  {
12
//*****************************************************************************************************************************************
13
    doit();
14
    profibus_send_CMD(SD1, DIAGNOSE, 0, &uart_buffer[7], OUTPUT_DATA_SIZE);
15
  }
16
//****while Schleife ende*******************************************************************************************************************
17
}

In der SPS Hardware Config zeigt er mir auch Teilnehmer nicht 
erreichbar.

Habe ich hier in dem Programm noch etwas vergessen. In der Bibliothek 
habe ich nichts verändert.

von Bastler (Gast)


Lesenswert?

Du kannst nicht einfach was an einen Master senden.

Der Master macht eine zyklische Anfrage, dann muss eine definierte 
Wartezeit eingehalten werden, erst dann erfolgt die Antwort.

Google mal nach "Profibus Felser" dort findest du eine gute Erklärung 
mit allen Abläufen.

Wenn du einen Frame erhalten hast startest du einen Timer mit 33 
Bitzeiten.
Wenn der Timer abgelaufen ist sendest du die Antwort.

.. und vergiss nicht die Richtung am RS485 Tranceiver umzuschalten.

von Piotr Kot (Gast)


Lesenswert?

Has anyone ported code to Arduino Due?

Antwort schreiben

Die Angabe einer E-Mail-Adresse ist freiwillig. Wenn Sie automatisch per E-Mail über Antworten auf Ihren Beitrag informiert werden möchten, melden Sie sich bitte an.

Wichtige Regeln - erst lesen, dann posten!

  • Groß- und Kleinschreibung verwenden
  • Längeren Sourcecode nicht im Text einfügen, sondern als Dateianhang

Formatierung (mehr Informationen...)

  • [c]C-Code[/c]
  • [code]Code in anderen Sprachen, ASCII-Zeichnungen[/code]
  • [math]Formel in LaTeX-Syntax[/math]
  • [[Titel]] - Link zu Artikel
  • Verweis auf anderen Beitrag einfügen: Rechtsklick auf Beitragstitel,
    "Adresse kopieren", und in den Text einfügen




Bild automatisch verkleinern, falls nötig
Bitte das JPG-Format nur für Fotos und Scans verwenden!
Zeichnungen und Screenshots im PNG- oder
GIF-Format hochladen. Siehe Bildformate.

Mit dem Abschicken bestätigst du, die Nutzungsbedingungen anzuerkennen.