TELKOM NIKA , Vol. 11, No. 12, Decem ber 20 13, pp.  7230 ~72 3 4   e-ISSN: 2087 -278X           7230      Re cei v ed  Jul y  2, 2013; Re vised Augu st  7, 2013; Acce pted Augu st 21, 2013     A Multi-core Heterogeneous Programmable  Automation Controller System of Cons truction  Machin     WANG G uoq ing*, YE Hong, Qu Jin, YANG Hu axin, LIU Cheng h uan   Ke y   Lab orator y of Road Co nst r uction T e chno lo g y  a nd Eq uip m ent, Ministr y   of Educatio n   Cha ng’ an U n iv ersit y Xi’ an 7 1 006 4, Shaa n x i,  Chin a   *Corres p o ndi n g  author, e-ma i l w a ng _g q@c hd.ed u.cn       A b st r a ct   T here  are tw mai n   issue s , hig h  cost  and  interr upt  respo n se  de la y for curre nt  PAC s   (progr ammab l e  automatio n co ntroll er s) w h ich are using h i gh  frequency sin g le-c hip  micro p rocess ors an d   commercial RTOS (real-tim e operating syst em )  working  by switching t h e tasks and interrupts. To solv these  pro b le ms, a n e w  low - cost multi-c o re  hetero g e neo us  PAC structur e  w a s pro pos ed . Based  o n  the   traditio nal fro n t-end  of interru pt service w i th out interr upt s w itching d e lay  and th e div i sio n  & de ploy men t  of   mu lti rea l -ti m e  tasks. We imple m ented  a n e w  progr a m mi ng la ng ua ge E ngi neer  C inc l udi ng its synta x,  compiler and an integrated deve lopm ent environm ent, which can  dyna mically divide the m u lti tasks an dep loy the  divi sion to si ng le l o w - cost microc ontrol l er,  then  built th e har dw are pr otot ype,  w h ich cons ists o f   a dig i tal si gn al bo ard, a n  ana log s i gn al  board  an d a  moti on co ntrol bo ard, ev e r y board  has  its   micr ocontr o ll er  an d co mmun i cates  each  ot her  by  a n  e n hanc ed SPI  b u s. T e sting  re sults sh ow  the  hardw are pr oto t ype and IDE c an be pr ovi ded  as a lo w - cost PAC soluti on for constructio n  mach in e.     Key w ords p r ogra m ma bl auto m ati o n  co ntroll er, multi- c o re hetero g e n eous, inte grat ed deve l o p m e n envir on me nt, engi neer C pr og ramming l a n g u age         Copy right  ©  2013 Un ive r sita s Ah mad  Dah l an . All rig h t s r ese rved .       1. Introduc tion  As the ne gene ration of  the indu stri al cont rolle rs, the prog ra mmable a u to mation  controlle r (PAC) is the  co re of the indu strial  auto m at ion platform.  At prese n t, the NI LabVIEW   integrate d  d e v elopment  e n vironm ent a nd it s adva n c ed  PAC Sy stem– C om pa ctRIO  are th e   leadin g  produ cts in th e PAC field [1]. In contrast,  Chi nese man u fa cture r s have i n trodu ce d PA prod uct s , but  most of  them  are  ba sed  on  the PL C  mod e l  (s uc h as   C o de s y s ,  Is gra f, KW )   o r  use   Win C E, VxWorks  and  oth e r fo reig n d e v elopment  sy st em  as the  platform. In t he  ca se th at  the   hard w a r e  IC manufa c tu rers a r e i n creasi ngly in cli ned to  provide a  comple te sol u tion, t he  difficulty of h a rd wa re  desi gn i s  g r ad ua lly r edu ce d.  Due  to the  lack of i ndep ende nt “PA C   integrate d  d e v elopment  en vironme n t”– c entere d  h a rd ware a nd  soft ware d e velop m ent platfo rm,  the Chin ese PAC manufa c ture rs are  st ill in the st ag e of fighting in hard w a r e a nd pri c e, ca n provide   mo re   add ed kn owledge   value  as NI or  oth e pro d u c ts.  With the  d e velopme n t of t h e   PAC, PAC platform mod e  for a parti cular p u rp ose  stand s out from the initia l gene ric PA mode s [2]. T he la ck  of in depe ndent  P A C inte grate d  devel opme n t platform  h a be com e   a   bottlene ck re stri cting the d e velopme n t of Chine s e PAC.  The  embe dd ed o perating  syste m  (O S)-ba s e d  PA C in evitably nee ds to  pro c e s interrupts  an d switch time  freque ntly. If a st a ck  ove r flow o r  oth e r ci rcumsta n ces h app ened unpredi ctable  errors would  occur. An d in low-co st o c ca sion s, si ngl e micro c ontroller  (MCU)  i s   widely u s ed t o  com p lete the syste m  d e velopme n t [3]. To this e nd, usin g a front-end m o d e   bas ed on t he div i sion  of  t a sks f o r mult i-mi cr oco n t r olle r,  we pr opo se d a mult i-c o r e   hetero gen eo us programm able autom ation cont rolle r system which  has co mplet e ly indepen d ent  intellectu a l property rig h ts.  This sy stem  con s ist s  of a prog ram m i ng and d ebu gging inte gra t ed  developm ent  environ ment  (IDE) fo r th e mult i-mi cro c ontrolle r, an d an IDE - su pporte d PAC  system’ s  ha rdwa re a r chitecture in whi c h the multi - MCU  ca n be  master-slav e  swit che d  a n d   flexibly config ured.     Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   e-ISSN:  2087 -278X       A Multi-co re  Heteroge neo us Pro g ram m able Autom a tion Co ntrolle System … (WANG Gu oqin g   7231 2. Design of  the Inte rgra ted Dev e lopment Env i ro ment  First of all,  comp are d  the cha r a c te ri st ic s of  c u rre nt  ma in stream prog ra mming  langu age s, base d  on the  core resea r chin g though t of "easy to  use, pra c tical to use, and   sufficie n t to use , we ind epen dently desig ned Engi neer  C lang uage, whi c is ba sed on  langu age, co mbined   with the  ch ar acte ristics of  C +  + / C  #, si m p lified the  syntax rule s a n d   improve d  the  prog ram m ing  usa b ility [4]. Then,  we d e signed  an  ordi nary text inpu t environm en t   and a  graphi cal input  environment. In  order to  ma ke   use r s with out  pro g ra mmin g  expe rien ce  to  use, a n  interactive autom atic code g e neratin sy stem wa s d e signed. Fin a ll y, in order t o   facilitate the user to manage co des, we also set up a docum ent  automatic gener ating system.     2.1. Ordinar y  Text Inpu t Env i ronment  The follo win g  figure i s  th text input en vironme n t bei ng con s tru c te d. From  the f i gure,  we  ca see  that the En ginee C la n guag e h a s t he  same  g r a mmatical  fea t ures with  th comm only u s ed high l e vel  prog ram m in g langu age s.  The text inp u t environ me nt impleme n ted   some  fun c tions  whi c h a r e  not su ppo rte d  in Keil uVi s ion such a s   variable tip s membe r  hint s,  indent of co d e  block, and  so on [5].          Figure 1. Screen shot of Engine er  C int egrate d  devel opment envi r onment       2.2. Graphic a l Input Env i ronment    The several  i n ternatio nal widely used p i ece s   of software  have  the f unctio n  of  gra phical  input, su ch  a s  Matlab/Sim u link, L abvie w, etc,  an d th e gra phi cal in put mode  is  good  eno ugh  to  decrea s e the  using difficul t y for the use r s. In vi ew of  this, we also  desig ned a  grap hical inp u environ ment  of flow cha r t model [6, 7], as sho w n in the figure b e lo w:             Figure 2. Engineer  C Flo w  Chat Input M ode       2.3. Interactiv e  Code  Au t o m a tic Gen e rating     Taking "Ea sy to use" a s  the ce ntral d e sig n   idea,  combine d  with  the actual  si tuation   that the  novi c es lack  programmi ng  abilities, in order to facilit at e the users to use, the I D integrate d  a n  intera ctive code a u tomati c ge ne rating  system. T h i s  sy stem  ca n analy z e th Evaluation Warning : The document was created with Spire.PDF for Python.
                               e-ISSN: 2 087-278X   TELKOM NIKA  Vol. 11, No . 12, Dece mb er 201 3:  723 0 – 7234   7232 informatio n submitted by users, and a u tomatically  co nverts it into Enginee r C code s. Combi ned   with the ab ove flow  cha r t input mod e , a  simple  syste m   can be co nstru c ted wit hout  writing  o n e   line  of cod e s.   Overall,  th e system co nsi s ts of  two  pa rts: (1 ) Usin g t he inte ra ctive pro m pt mo d e the system  g e ts code  par ameters fro m  spe c ific i npu t forms,  an d then a u tomati cally ge nerates  Enginee r C code s; (2) Setting for the useful  ha rd wa re modul es: the entire software syste m   serv i c e s  fo h a rd wa re, it i s   not ea sy  fo r t he b egin ners to ma ste r  th e la rge  am ou nt of h a rd wa re  function s q u i ckly. To thi s   end, ha rd wa re modul es  setup gui ding  prog ram  wa s desi gne d. As  long a s  the  use r  dete r mi nes  whi c h fu nction s to b e  use d  an d completed th e  setting of th e   module s ’ pa rameters, Eng i neer  C co de s will be e a sil y  attained.          Figure 3. Engineer  C Auto ma tic Co de G enerating System      2.4. Docume nt Au toma tic  Genera ting   For th situa t ion that  writi ng  softwa r e   document i s  a h eavy wo rklo ad, in  o r der t o   facilitate the  users to use,  a  software docum ent  automatic gen erating system was  designed.  This system can automati c ally  extra c the  comment s from the cod e  lines i n  the  text, combini ng  with the ana lysis of the use r ’s p r og ra m, to  generate the diagram of callin g relation shi p betwe en fu n c tion s [8], a s  sh own in  Fi gure  4.  M e a n whil e, a fu n c tion  ann otation g ene ratin g   system  was  provided. In this  system, a text f ile will be generated as the output to form the  use r ’s softwa r do cum ent.        Figure 4. Use r ’s Softwa r Do cume nt Automatic Ge ne rating System       3. Design of  the Hard w a r e  Modules   The  hardware pa rt of t h is  multi-core  hete r og en eou s p r og ra mmable  aut omatio n   controlle r sy stem is m a inl y  comp osed  of six pa rt of a ba se  bo ard, three  pi ece s  of m o th er  board, five pieces of  so n boa rd, a diagn os i s  m odule, a syn c hrono us  de bugg er an an  enha nced SPI bus. Among them, the base board  contai n s  po wer-sup ply facilities,   comm uni cati on devi c e s  a nd syn c h r on ous  deb ugge r bu se s, etc.  The three pi ece s  of moth er  board a r e  a nalog  si gnal  mothe r bo ard, digital  si gnal m o the r board a nd  motion  cont rol  motherboa rd.  They are co nne cted to e a ch  ot her th rough th e custom enha nce d  SPI bus a n d   installe d on the base boa rd by pins. The diagno si module i s  a level signal  co llecting ci rcuit  for  Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   e-ISSN:  2087 -278X       A Multi-co re  Heteroge neo us Pro g ram m able Autom a tion Co ntrolle System … (WANG Gu oqin g   7233 the logic  anal yzer. On e of i t s end s is  co nne cted to th e three  pie c e s  of mothe r  b oard to  reali z the level sig n a l colle cting f o r the mot h e r  boa rd s,  an d the othe r e nd is  con n e c ted to a PC t o   achi eve the a nalysi s  for th e acq u ired le vel signal . Th e five piece s   of son b oard inclu de: DAC  interface extende d ci rcuit, ADC interf ace exte n d e d  circuit, I/O interface ex tended  circui t,  stepp er moto r controlling   i n terface extended   ci rcuit  and  en cod e r interfa c e  ex tended  ci rcui t.  They are in st alled on the  resp ective mo ther bo ar d, to  extend the functio n s of th e three pi ece s   of mother  bo ard. Th e two  end s of the  synchr ono us d ebug ger are respe c tively  conne cted  to a  PC and the three pi eces o f  mother boa rd, used  to a c hieve the syn c hrono us d e b uggin g  for the  motherboa rd s [9, 10].      Figure 5. The  Conn ectio n  Diag ram of th e System’s Hard wa re Mod u les      3.1. Mother  Board s   Each m o the r board h a s it s own  fun c tion  modul es  an d se pa rate  commutation  module s distrib u ted control - supp orted  field bus-CAN, RS4 8 5  interface,  USB serial bu s, downloadi ng   and  deb uggi ng inte rfa c e-JTAG,  asyn chron o u s   com m unication -u sed  unive rsal  se rial  data  b u s- UART  and S P I bus interf ace, an d so  on. The s e m odule s  can e n su re the in d epen dent an asyn chrono u s  wo rk of ea ch moth erb o a rd. The  th re e pieces  of motherboa rd  have the sa me   level an d the y  achi eve th e ma ster-sla ve swit ch  of  interrupt resp onse mo de  by the  cu sto m   enha nced SP I bus. At any  time in the  ru nning  proc ess, only o ne  piece  of moth e r  bo ard  can b e   the maste r  an d the others should b e  slav es.   The three pi e c e s  of mothe r boa rd can b e  run se pa rat e ly and also  can be  combi ned to   accompli sh  complex ap pli c ation s   when  neede d. Th e analo g  si g nal mothe r bo ard i s  u s ed t o   conve r t the  collecte d  di gita l sig nal to  an alog vo lta ge  sign al by  DA C a nd th en  convert th e o u tput   of 0 to 2.5V v o ltage s to  ±1 0V thro ugh th e ba ckwa rd  chann el ci rcuit ,  use d  in th analo g  contro for the servo  motor. The DAC interfa c e ext ended  circuit and the ADC in te rface extended  circuit  are  con n e c te d to the an alo g  sig nal moth erbo ard. The  digital si gnal  motherboa rd  is u s ed fo r th input and o u t put of the controlle r’ s switching valu e s . The I/O interface extended  circuit is  con n e c ted to  the digital  si gnal m o therb oard. T he m o tion control  board i s  u s e d  to control t he  stepp er m o to r and  used fo r the inp u t of the spe c ia l sig nals (o rigin si gnal,  po sitive limit,  negative   spa c in g, etc.). The step per motor contro lling  interfa c e  extended  circuit and  en coder i n terfa c extended  circuit are co nne cted to  the m o tion co ntrol  motherboa rd.     3.2. The Dia gnosis Mod u le and Sy n c hronou s De bugger       (a)     (b)      Figure 6. (a ) The three pi ece s  of moth er boa rd; (b The syn c h r on ous d ebu gge Evaluation Warning : The document was created with Spire.PDF for Python.
                               e-ISSN: 2 087-278X   TELKOM NIKA  Vol. 11, No . 12, Dece mb er 201 3:  723 0 – 7234   7234 The di agno si s mo dule i s  a  level sig nal  colle cting  circuit for the l o g i c an alyze r , u s ed t o   colle ct the le vel signal fo r the three pi ece s  of  moth erbo ard, then  analyzin g a nd sh owi ng the  colle cted l e vel sig nal  on  the PC. T he  synch r o n ous deb ugg er a nd th three  pie c e s  of  motherboa rd  co nstitute  a  self -organi zi ng  re co n s tru c tion syste m whi c h   can well en sure  t h e   reconfigu r a b ility and pro g ramm ability of this m u lti-co re h e terog ene ou s prog ram m a b le   automation controlle r.     3.3. The Enhanced SPI Bus   The cu stom   e nhan ce SPI bus  in clud es 12 si gn al lin e s , which a r e   data lin es an d cl ock  lines (SPI_S CK, SPI_MISO and SPI_MOSI), chip -s ele c ting si g nal lines  (NS S 0, NSS1, NSS2,  NSS3 and SPI_NSS) and  interrupt si g nal lines (I T 0 , IT1,  IT2 and IT3), and u p  to four MCUs’  synchro nou s co mmuni cati on  can  be  suppo rted.  A m ong  them,  the data  an d  clo c k lin es  are   use d  for d a ta  transmitting  among th e h o st an d the  sl aves, the  shi p -sele c ted lin es a r e u s e d  for  the ho st to  select ta rg et sl aves  and  the  interrupt  si g nal lin es a r use d  to  send  interrupt  si g nal   from the  slav es to th e h o st , so a s  to  inte rru pt t he  sign al of the  ho st  and  set itself  to be the  ho st  and the othe rs to be the sl aves. This  cu stom  enh an ced SPI bus can achieve the re spo ndin g   con n e c tion of  interru pt mode amon g the  host and  sla v es.      4. Conclusio n   The multi-co re heteroge ne ous p r o g ra m m able a u tom a tion co ntroll er put forwa r d in this  pape r, usi n g  a front-end  mode b a se d on the di v i sion  of tasks for m u lti-CPU mod e , can  effectively sol v e the proble m of heavie r system lo a d , poore r  re a l -time re spo n d ing ability for  multi tasks  and relativel y  lower  pro c e ssi ng efficiency, whi c h  exist in the traditio n a l   prog ram m abl e automatio n  controlle r system  ba sed  on emb edd ed op eratin g  system. Th e   Enginee r C i n tegrate d  de velopment e n vironm ent provided a p r o g rammi ng la ngua ge of ea sy  learni ng  and  use  and  set  up the  mod u les  of text inp u t pro g ra mmi ng, graphi cal  pro g ra mmin g cod e  automa t ic gene rating  and software document  automatic  ge neratin g, etc.  It provided an   efficient way for the develo p ing an d deb uggin g   for the  multi-co re he teroge neo us  system.        Ackno w l e d g ement  This work wa s su ppo rted  by the Chine s e cent ral fin anci a l sci entific re sea r ch fund for  university (CHD201 0JC09 1 ).  We  wo uld  like  to th a n k the  an onymo us revie w e r s for  thei h e lpf u comm ent s.       Referen ces   [1]    X i ao SUN,  Hao ZHOU. Research  of Co ntrol  S y st em of P a ckagi ng M a chi ne  on  PLC.  TEL K OMNIKA  Indon esi an Jou r nal of Electric al Eng i ne eri n g .  2013; 1 1 (6): 3 060- 306 5.   [2]   James  T r uchard.  Letter fro m  Dr. Ja mes  T r uchar d, CEO  and  Cofo un de r of N a tion al I n strument http:// w w w . ni.com/eso/   [3]    Jiejia  LI, Rui  QU, Yang CH EN. Co nstructi on E qui pme n t Co ntrol  Rese arch B a sed  o n  Pre d ictiv e   T e chnolog y.  T E LKOMNIKA Indo nesi an Jo u r nal of Electric al Eng i ne eri n g .  2012; 1 0 (5): 9 60-9 67.   [4]    W ang Guo q i n g ,  W ang Yo ng xi n.  Confi gur abl e Integr ated D e vel o p m e n t En viron m e n t Soft w a re for th e   Contro ller of C onstructio n  Ma chin ery . Cop y ri ght of Comput er Soft w a re, N o . 0352 30 6. 20 11-1 1 -29.   [5]    Yu Jiquan, Qian Wantao.  Stu d y on  an I n teg r ated D e vel o p m e n t Envir o n m ent for PAC w i t h Co mp let e   Intellectual Property . App lie Mecha n ics  and  Materia l s. T r a n s T e ch Publ ic ations. S w itz e rl and.  201 2;   135- 136: 9 44-9 49.   [6]    Rui M onteir o , Luís Pa ulo  Reis, Antó n i o C o rrei a  P e reira.  Huma noi d D y n a mic  Contro ller .   T E LKOMNIKA Indon esi an Jou r nal of Electric al Eng i ne eri n g .  2012; 1 0 (8): 1 936- 194 7.   [7]    W ang Guoq in g, Li F eng.  Graph ical Inte gr ated Dev e l o p m e n t Enviro n m e n t System  for the Rob o Brain . Co p y rig h t of Computer  Soft w a r e . 201 1; No. 036 214 7.  [8]    W ang Gu oq ing ,  Ye H o n g Eng i ne e r   C  Graph i c a l  Prog ramm in g System   V1 .0 . Co p y ri gh t of Com pute r   Soft w a re. 20 13 ; 05223 82.   [9]   Z hang   Yun bo,  Study o n  the  k e y tech nol ogi e s  of inte lli ge nt control al gorith m  acco mp lish e d   by  PA C Journ a l of Ch a ngch un Institut of  T e chnol og y (Natur al Sci e nc es Editi on). 201 0; 3: 51-54.   [10]    W ang Gu oqi n g , Yan g  H u a x i n Async h ro nous  Multi-c o r e  Pro g ra mma b le A u to mati o n  Co ntrol l er Chin ese Pat e n t. 2013; CN1 02 929 19 4A.  Evaluation Warning : The document was created with Spire.PDF for Python.