spark Posted August 22, 2017 Share Posted August 22, 2017 Hello everyone: I'm using a turbo PMAC2 CPU, and I have a serial devices need to interface with the delta tau(receive some HEX data from PMAC). The problem happened as follow: I'm trying to a set of HEX numbers like "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D"(14 numbers in total),all these values are assigned to the M-variables from M0-M13, the PLC program are listed blow. --------Begining of the program------- CLOSE I52=5 ;Basic setup to enable auxiliary serialport I53=15 ;Baud rate is set to 115200 I1 = 1 I43 = 3 M100->X:$FFFFE1,24 ;The number of bytes to output M101->X:$FFFFE3,24 ;Starting address to send M102->X:$FFFFE0,23 ;bit 23 of X:$FFFFE0 must be set to 1 to enable the output M0->Y:$3600,0,8 M1->Y:$3601,0,8 M2->Y:$3602,0,8 M3->Y:$3603,0,8 M4->Y:$3604,0,8 M5->Y:$3605,0,8 M6->Y:$3606,0,8 M7->Y:$3607,0,8 M8->Y:$3608,0,8 M9->Y:$3609,0,8 M10->Y:$3610,0,8 M11->Y:$3611,0,8 M12->Y:$3612,0,8 M13->Y:$3613,0,8 OPEN PLC1 CLEAR M0=$00 M1=$01 M2=$02 M3=$03 M4=$04 M5=$05 M6=$06 M7=$07 M8=$08 M9=$09 M10=$0A M11=$0B M12=$0C M13=$0D M101=$3600 M100=13 M102=1 DISABLE PLC 1 CLOSE" ------End of the program--------- But I received a string "00 01 02 03 04 05 06 07 08 09 00 00 00 00", then, I changed the value of "M100" to "19", and I received a string "00 01 02 03 04 05 06 07 08 09 00 00 00 00 00 0A 0B 0C 0D 00", I'm curious about this output, why does five 0 Byte appear? anyone could tell me what happened? Thanks a lot! Link to comment Share on other sites More sharing options...
Unit101 Posted August 22, 2017 Share Posted August 22, 2017 --- you are not assigning the Mvar registers in order as you think... there are 5 extra registers in the middle... change you addressing so they are all in sequence M0->Y:$3600,0,8 M1->Y:$3601,0,8 M2->Y:$3602,0,8 M3->Y:$3603,0,8 M4->Y:$3604,0,8 M5->Y:$3605,0,8 M6->Y:$3606,0,8 M7->Y:$3607,0,8 M8->Y:$3608,0,8 M9->Y:$3609,0,8 .... here are the 5 0 bytes... they are between 3609 and 3610 Y:$360A Y:$360B Y:$360C Y:$360D Y:$360E M10->Y:$3610,0,8 change this to 360A M11->Y:$3611,0,8 change this to 360B M12->Y:$3612,0,8 change this to 360C M13->Y:$3613,0,8 change this to 360D Link to comment Share on other sites More sharing options...
spark Posted August 23, 2017 Author Share Posted August 23, 2017 --- you are not assigning the Mvar registers in order as you think... there are 5 extra registers in the middle... change you addressing so they are all in sequence M0->Y:$3600,0,8 M1->Y:$3601,0,8 M2->Y:$3602,0,8 M3->Y:$3603,0,8 M4->Y:$3604,0,8 M5->Y:$3605,0,8 M6->Y:$3606,0,8 M7->Y:$3607,0,8 M8->Y:$3608,0,8 M9->Y:$3609,0,8 .... here are the 5 0 bytes... they are between 3609 and 3610 Y:$360A Y:$360B Y:$360C Y:$360D Y:$360E M10->Y:$3610,0,8 change this to 360A M11->Y:$3611,0,8 change this to 360B M12->Y:$3612,0,8 change this to 360C M13->Y:$3613,0,8 change this to 360D Oops!I have made the elementary mistake, the address is a HEX number. thanks a lot, @Unit101! You have done me a great favor. Link to comment Share on other sites More sharing options...
spark Posted August 27, 2017 Author Share Posted August 27, 2017 --- you are not assigning the Mvar registers in order as you think... there are 5 extra registers in the middle... change you addressing so they are all in sequence M0->Y:$3600,0,8 M1->Y:$3601,0,8 M2->Y:$3602,0,8 M3->Y:$3603,0,8 M4->Y:$3604,0,8 M5->Y:$3605,0,8 M6->Y:$3606,0,8 M7->Y:$3607,0,8 M8->Y:$3608,0,8 M9->Y:$3609,0,8 .... here are the 5 0 bytes... they are between 3609 and 3610 Y:$360A Y:$360B Y:$360C Y:$360D Y:$360E M10->Y:$3610,0,8 change this to 360A M11->Y:$3611,0,8 change this to 360B M12->Y:$3612,0,8 change this to 360C M13->Y:$3613,0,8 change this to 360D Hello Unit101, sorry to disturb you again, I'd like to know whether PMAC send bytes one by one to serial port, or all bytes at one shot. Thanks for your time! Link to comment Share on other sites More sharing options...
Recommended Posts