西门子1200贪吃蛇程序带触摸屏可仿真 点击:6514 | 回复:120



zeyao00

    
  • 精华:1帖
  • 求助:0帖
  • 帖子:10帖 | 115回
  • 年度积分:644
  • 历史总积分:8789
  • 注册:2018年4月13日
发表于:2019-11-19 14:57:43
楼主

西门子1200贪吃蛇 程序带触摸屏 可仿真 SCL 博图V14

正在下载,请等待……
下载附件需3积分!




风扇12

  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 267回
  • 年度积分:1
  • 历史总积分:78
  • 注册:2017年4月16日
发表于:2020-02-25 00:03:50
41楼

谢谢分享 谢谢分享 谢谢分享

注册帐号真麻烦

  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 95回
  • 年度积分:0
  • 历史总积分:85
  • 注册:2017年12月18日
发表于:2020-02-26 09:38:18
42楼

感谢楼主分享!学习学习。

白墨13997

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 50回
  • 年度积分:49
  • 历史总积分:100
  • 注册:2014年4月25日
发表于:2020-03-13 15:13:17
43楼

厉害,看看

浪迹江湖@

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 44回
  • 年度积分:0
  • 历史总积分:54
  • 注册:2019年4月24日
发表于:2020-03-15 10:51:34
44楼

路过来劲,小明看看

学习ab12

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 51回
  • 年度积分:0
  • 历史总积分:66
  • 注册:2015年10月31日
发表于:2020-03-17 10:09:36
45楼


谢谢楼主分享,厉害,学习了


fuli0315

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 8回
  • 年度积分:0
  • 历史总积分:165
  • 注册:2020年3月29日
发表于:2020-03-29 18:51:29
46楼

厉害了,谢谢分享

邦尼di猪

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 102回
  • 年度积分:0
  • 历史总积分:51
  • 注册:2009年2月20日
发表于:2020-03-29 21:17:17
47楼

谢谢分享 好好学习

NJDSQ

  • 精华:0帖
  • 求助:2帖
  • 帖子:10帖 | 177回
  • 年度积分:15
  • 历史总积分:806
  • 注册:2010年7月07日
发表于:2020-04-03 09:24:08
48楼

你们是做电气的还是做软件的?

feiye1007

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 24回
  • 年度积分:0
  • 历史总积分:230
  • 注册:2013年4月25日
发表于:2020-04-05 13:43:04
49楼

sub short RAND_num(short para)
RAND(para)
return para
end sub
macro_command main()
bool button_flag[3],game_run,game_over,game_pause,game_init,eat_flag,bool_true = true,bool_false = false
bool display_snake[320],display_init[320]
short direction,pro_direction,get_dir,init_dir = 1
short snake_head_p,snake_cell_p,snake_body_p[318]
short snake_martix[320],snake_pre_martix[320]
short score,best_score,snake_length,speed
short start_rand,next_rand,next_point
short init_index,display_index,count_index,length_index
short temp_body,temp_next_body,temp_last_body
GetData(get_dir, "Local HMI", LW, 0, 1)
GetData(button_flag[0], "Local HMI", LB, 0, 3)
GetData(speed, "Local HMI", RW, 28, 1)
if get_dir==1 and pro_direction<>2 then
 direction = 1
 pro_direction = 1
else if get_dir==2 and pro_direction<>1 then
 direction = 2

邦尼di猪

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 102回
  • 年度积分:0
  • 历史总积分:51
  • 注册:2009年2月20日
发表于:2020-04-06 00:54:24
50楼

谢谢楼主分享,已果断下载

七彩

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 11回
  • 年度积分:0
  • 历史总积分:106
  • 注册:2020年4月05日
发表于:2020-04-06 10:55:31
51楼

感谢分享1!!!

gk2017

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 142回
  • 年度积分:0
  • 历史总积分:55
  • 注册:2018年3月19日
发表于:2020-04-06 21:35:44
52楼

怦怦在左边,你在怦怦里面

间距

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 63回
  • 年度积分:0
  • 历史总积分:106
  • 注册:2020年3月29日
发表于:2020-04-12 03:23:21
53楼

共同学习共同学习共同学习

ju691031

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 2258回
  • 年度积分:5
  • 历史总积分:106
  • 注册:2010年7月16日
发表于:2020-04-12 18:36:06
54楼

下載下來看看

截科市

  • 精华:0帖
  • 求助:0帖
  • 帖子:1帖 | 36回
  • 年度积分:11
  • 历史总积分:213
  • 注册:2019年5月26日
发表于:2020-04-19 07:40:32
55楼

回复内容:

对:IE5338 sub short RAND_num(short para)RAND(para)return paraend submacro_command main()bool button_flag[3],game_run,game_over,game_pause,game_init,eat_flag,bool_true = true,bool_false = falsebool display_snake[320],display_init[320]short direction,pro_direction,get_dir,init_dir = 1short snake_head_p,snake_cell_p,snake_body_p[318]short snake_martix[320],snake_pre_martix[320]short score,best_score,snake_length,speedshort start_rand,next_rand,next_pointshort init_index,display_index,count_index,length_indexshort temp_body,temp_next_body,temp_last_bodyGetData(get_dir, "Local HMI", LW, 0, 1)GetData(button_flag[0], "Local HMI", LB, 0, 3)GetData(speed, "Local HMI", RW, 28, 1)if get_dir==1 and pro_direction<>2 then direction = 1 pro_direction = 1else if get_dir==2 and pro_direction<>1 then direction = 2 pro_direction = 2else if get_dir==3 and pro_direction<>4 then direction = 3 pro_direction = 3else if get_dir==4 and pro_direction<>3 then direction = 4 pro_direction = 4end ifif button_flag[2] then score = 0 SetData(score, "Local HMI", RW, 20, 1) snake_length = 3 SetData(bool_false, "Local HMI", LB, 100, 1) FILL(display_snake[0],0,320) FILL(display_init[0],0,320) FILL(snake_martix[0],0,320) FILL(snake_pre_martix[0],0,320) eat_flag = false game_over = false game_pause = false   game_init = trueend ifif game_init and not button_flag[2] then RAND(start_rand) if start_rand >= 32000 then  RAND(start_rand) end if snake_head_p = start_rand/100 if snake_head_p%16 > 2 then  snake_body_p[0] = snake_head_p - 1  snake_cell_p = snake_head_p - 2  init_dir = 4  SetData(init_dir, "Local HMI", LW, 0, 1)  direction = 4  pro_direction = 4 else if snake_head_p%16 <= 2 then  snake_body_p[0] = snake_head_p + 1  snake_cell_p = snake_head_p + 2  init_dir = 3  SetData(init_dir, "Local HMI", LW, 0, 1)  direction = 3  pro_direction = 3 end if RAND(next_rand) next_point = next_rand/100 if next_point >= 320 or next_point == snake_head_p or next_point == snake_body_p[0] or next_point == snake_cell_p then  RAND(next_rand) end if next_point = next_rand/100 display_init[next_point] = true for init_index = 0 to 319 step 1  if init_index == snake_head_p or init_index == snake_body_p[0] or init_index == snake_cell_p then   snake_martix[init_index] = 1   display_snake[init_index] = true   display_init[init_index] = true   SetData(display_snake[0], "Local HMI", RW_Bit, 0.0, 320)   SetData(display_init[0], "Local HMI", RW_Bit, 30.0, 320)  end if  snake_pre_martix[init_index] = snake_martix[init_index] next init_index game_run = true game_init = false DELAY(80) end ifif game_run then if direction == 1 then  if snake_head_p > 15 then   if not eat_flag then    snake_pre_martix[snake_cell_p] = 0    snake_cell_p = snake_body_p[0]    if snake_length>3 then     for length_index = 0 to snake_length-4 step 1      //temp_last_body = length_index + 4      temp_next_body = length_index + 1      snake_body_p[length_index] = snake_body_p[temp_next_body]      //if temp_next_body == 1 then      // break      //end if     next length_index    end if    temp_body = snake_length-3    snake_body_p[temp_body] = snake_head_p    snake_head_p = snake_head_p - 16   else if eat_flag then    for length_index = 3 to 318 step 1     if length_index == snake_length then      temp_body = snake_length-3      snake_body_p[temp_body] = snake_head_p      snake_head_p = snake_head_p - 16      eat_flag = false      TRACE("length_index=%d",length_index)      TRACE("snake_body_p[0]=%d",snake_body_p[temp_body])      TRACE("snake_body_p[1]=%d",snake_body_p[temp_body])      TRACE("snake_body_p[0]=%d",snake_body_p[0])      break     end if    next length_index    TRACE("snake_length=%d",snake_length)   end if   for count_index = 0 to 319 step 1    snake_martix[count_index] = snake_pre_martix[count_index]   next count_index   snake_martix[snake_head_p] = 1  else if snake_head_p <=15 then   game_over = true  end if else if direction == 2 then  if snake_head_p <= 303 then   if not eat_flag then    snake_pre_martix[snake_cell_p] = 0    snake_cell_p = snake_body_p[0]    if snake_length>3 then     for length_index = 0 to snake_length-4 step 1      //temp_last_body = snake_length - 4      temp_next_body = length_index + 1      snake_body_p[length_index] = snake_body_p[temp_next_body]     next length_index    end if    temp_body = snake_length-3    snake_body_p[temp_body] = snake_head_p    snake_head_p = snake_head_p + 16    //snake_pre_martix[snake_cell_p] = 0    //for length_index = snake_length down 3 step 1    // temp_body = length_index-3    // snake_cell_p = snake_body_p[temp_body]    // snake_body_p[temp_body] = snake_head_p    //next length_index    //snake_head_p = snake_head_p + 16   else if eat_flag then    for length_index = 3 to 318 step 1     if length_index == snake_length then      temp_body = snake_length-3      snake_body_p[temp_body] = snake_head_p      snake_head_p = snake_head_p + 16      eat_flag = false      TRACE("length_index=%d",length_index)      TRACE("snake_body_p[0]=%d",snake_body_p[temp_body])      TRACE("snake_body_p[1]=%d",snake_body_p[temp_body])      TRACE("snake_body_p[0]=%d",snake_body_p[0])      break     end if    next length_index   end if   for count_index = 0 to 319 step 1    snake_martix[count_index] = snake_pre_martix[count_index]   next count_index   snake_martix[snake_head_p] = 1  else if snake_head_p > 303 then   game_over = true  end if else if direction == 3 then  if snake_head_p<>0 and snake_head_p<>16 and snake_head_p<>32 and snake_head_p<>48 and snake_head_p<>64 and snake_head_p<>80 and snake_head_p<>96 and snake_head_p<>112 and snake_head_p<>128 and snake_head_p<>144 and snake_head_p<>160 and snake_head_p<>176 and snake_head_p<>192 and snake_head_p<>208 and snake_head_p<>224 and snake_head_p<>240 and snake_head_p<>256 and snake_head_p<>272 and snake_head_p<>288 and snake_head_p<>304 then    if not eat_flag then    snake_pre_martix[snake_cell_p] = 0    snake_cell_p = snake_body_p[0]    if snake_length>3 then     for length_index = 0 to snake_length-4 step 1      //temp_last_body = snake_length - 4      temp_next_body = length_index + 1      snake_body_p[length_index] = snake_body_p[temp_next_body]     next length_index    end if    temp_body = snake_length-3    snake_body_p[temp_body] = snake_head_p    snake_head_p = snake_head_p - 1        //snake_pre_martix[snake_cell_p] = 0    //for length_index = snake_length down 3 step 1    // temp_body = length_index-3    // snake_cell_p = snake_body_p[temp_body]    // snake_body_p[temp_body] = snake_head_p    //next length_index    //snake_head_p = snake_head_p - 1   else if eat_flag then    for length_index = 3 to 318 step 1     if length_index == snake_length then      temp_body = snake_length-3      snake_body_p[temp_body] = snake_head_p      snake_head_p = snake_head_p - 1      eat_flag = false      TRACE("length_index=%d",length_index)      TRACE("snake_body_p[0]=%d",snake_body_p[temp_body])      TRACE("snake_body_p[1]=%d",snake_body_p[temp_body])      TRACE("snake_body_p[0]=%d",snake_body_p[0])      break     end if    next length_index   end if         for count_index = 0 to 319 step 1    snake_martix[count_index] = snake_pre_martix[count_index]   next count_index   snake_martix[snake_head_p] = 1  else if snake_head_p==0 or snake_head_p==16 or snake_head_p==32 or snake_head_p==48 or snake_head_p==64 or snake_head_p==80 or snake_head_p==96 or snake_head_p==112 or snake_head_p==128 or snake_head_p==144 or snake_head_p==160 or snake_head_p==176 or snake_head_p==192 or snake_head_p==208 or snake_head_p==224 or snake_head_p==240 or snake_head_p==256 or snake_head_p==272 or snake_head_p==288 or snake_head_p==304 then   game_over = true    end if else if direction == 4 then  if snake_head_p<>15 and snake_head_p<>31 and snake_head_p<>47 and snake_head_p<>63 and snake_head_p<>79 and snake_head_p<>95 and snake_head_p<>111 and snake_head_p<>127 and snake_head_p<>143 and snake_head_p<>159 and snake_head_p<>175 and snake_head_p<>191 and snake_head_p<>207 and snake_head_p<>223 and snake_head_p<>239 and snake_head_p<>255 and snake_head_p<>271 and snake_head_p<>287 and snake_head_p<>303 and snake_head_p<>319 then   if not eat_flag then    snake_pre_martix[snake_cell_p] = 0    snake_cell_p = snake_body_p[0]    if snake_length>3 then     for length_index = 0 to snake_length-4 step 1      //temp_last_body = snake_length - 4      temp_next_body = length_index + 1      snake_body_p[length_index] = snake_body_p[temp_next_body]     next length_index    end if    temp_body = snake_length-3    snake_body_p[temp_body] = snake_head_p    snake_head_p = snake_head_p + 1        //snake_pre_martix[snake_cell_p] = 0    //for length_index = snake_length down 3 step 1    // temp_body = length_index-3    // snake_cell_p = snake_body_p[temp_body]    // snake_body_p[temp_body] = snake_head_p    //next length_index    //snake_head_p = snake_head_p + 1   else if eat_flag then    for length_index = 3 to 318 step 1     if length_index == snake_length then      temp_body = snake_length-3      snake_body_p[temp_body] = snake_head_p      snake_head_p = snake_head_p + 1      eat_flag = false      TRACE("length_index=%d",length_index)      TRACE("snake_body_p[0]=%d",snake_body_p[temp_body])      TRACE("snake_body_p[1]=%d",snake_body_p[temp_body])      TRACE("snake_body_p[0]=%d",snake_body_p[0])      break     end if    next length_index   end if   for count_index = 0 to 319 step 1    snake_martix[count_index] = snake_pre_martix[count_index]   next count_index   snake_martix[snake_head_p] = 1  else if snake_head_p==15 or snake_head_p==31 or snake_head_p==47 or snake_head_p==63 or snake_head_p==79 or snake_head_p==95 or snake_head_p==111 or snake_head_p==127 or snake_head_p==143 or snake_head_p==159 or snake_head_p==175 or snake_head_p==191 or snake_head_p==207 or snake_head_p==223 or snake_head_p==239 or snake_head_p==255 or snake_head_p==271 or snake_head_p==287 or snake_head_p==303 or snake_head_p==319 then   game_over = true  end if end if for display_index = 0 to 319 step 1  //if display_index == snake_head_p or display_index == snake_body_p[0] or display_index == snake_cell_p then  if snake_martix[display_index] == 1 then   display_snake[display_index] = true   display_init[display_index] = true   //TRACE("snake_martix[display_index]=%d",snake_martix[display_index])   //TRACE("display_index=%d",display_index)  else if snake_martix[display_index] <> 1 then   display_snake[display_index] = false   display_init[display_index] = false   end if  snake_pre_martix[display_index] = snake_martix[display_index] next display_index if next_point == snake_head_p then  RAND(next_rand)  next_point = next_rand/100  if next_point >= 320 or next_point == snake_head_p or next_point == snake_body_p[0] or next_point == snake_cell_p then   RAND(next_rand)  end if  next_point = next_rand/100  snake_length = snake_length + 1  eat_flag = true  score = score + 1  SetData(score, "Local HMI", RW, 20, 1) end if display_init[next_point] = true SetData(display_snake[0], "Local HMI", RW_Bit, 0.0, 320) SetData(display_init[0], "Local HMI", RW_Bit, 30.0, 320) if score>best_score then  best_score = score  SetData(score, "Local HMI", RW, 21, 1) end if DELAY(speed)end ifif game_over then game_run = false SetData(bool_true, "Local HMI", LB, 100, 1) game_over = falseend ifif button_flag[0] then game_run = trueend ifif button_flag[1] then game_run = falseend ifend macro_command     内容的回复:

感谢分享,周立齐,现代著名 思想家,教育家,哲学家,文学家;代表作有《窃·格瓦拉大年三十不回家》、《不打工的秘密》、《电瓶终结者》《苦命的电瓶车啊,名震江湖的窃格瓦拉为你撑起一片天》《浮生六窃》《我为什么拒绝打工》《别人避之不及的看守所,我的安身之地》《南宁,今夜请将我遗忘》

厂里一电工

  • 精华:0帖
  • 求助:1帖
  • 帖子:3帖 | 29回
  • 年度积分:0
  • 历史总积分:149
  • 注册:2004年9月15日
发表于:2020-04-20 10:34:35
56楼

这个必须要学习一下哈

间距

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 63回
  • 年度积分:0
  • 历史总积分:106
  • 注册:2020年3月29日
发表于:2020-04-20 21:32:27
57楼

学习中多多关罩

yunwan1986

  • 精华:0帖
  • 求助:0帖
  • 帖子:0帖 | 5回
  • 年度积分:0
  • 历史总积分:51
  • 注册:2020年4月20日
发表于:2020-04-21 10:47:05
58楼

点赞点赞,谢谢分享啦

1234567890

  • 精华:0帖
  • 求助:0帖
  • 帖子:7帖 | 397回
  • 年度积分:11
  • 历史总积分:270
  • 注册:2017年9月09日
发表于:2020-05-15 13:54:06
59楼

这个不错,我晚上测试一下,谢谢楼主分享

mumu9527

  • 精华:0帖
  • 求助:0帖
  • 帖子:4帖 | 126回
  • 年度积分:0
  • 历史总积分:194
  • 注册:2020年5月15日
发表于:2020-06-03 21:49:46
60楼

感谢楼主分享这么好的东西,支持


热门招聘
相关主题

官方公众号

智造工程师