Advertisement
Guest User

source

a guest
Dec 7th, 2011
4,418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.40 KB | None | 0 0
  1. Define CONF_WORD = 0x3f70
  2. AllDigital 'Todos los pines del PORTA como E/S
  3. TRISA = 0x00
  4. TRISB = 0x00 'Configuro el PORTB completo como salida.
  5.  
  6. Symbol motorpen1 = PORTA.0
  7. Symbol motorpen2 = PORTA.1
  8. Symbol motora1 = PORTB.0
  9. Symbol motora2 = PORTB.1
  10. Symbol motorb1 = PORTB.2
  11. Symbol motorb2 = PORTB.3
  12. Symbol bobina1 = PORTB.4
  13. Symbol bobina2 = PORTB.5
  14. Symbol bobina3 = PORTB.6
  15. Symbol bobina4 = PORTB.7
  16.  
  17. PORTB = 0x00
  18. PORTA = 0x00
  19. Dim sleeptime As Byte
  20. Dim sleeppap As Byte
  21. Dim cambio As Bit
  22. Dim fila As Byte
  23. Dim fila2 As Byte
  24. Dim fila3 As Byte
  25. Dim fila4 As Byte
  26. Dim fila5 As Byte
  27. Dim bipo As Byte
  28.  
  29. bipo = 1
  30. sleeppap = 2
  31.  
  32. fila = 255
  33. fila2 = 255
  34. fila3 = 255
  35. fila4 = 255
  36. fila5 = 255
  37.  
  38. cambio = True
  39.  
  40. inicio:
  41. botones:
  42.  
  43. Gosub avanzarmotor1
  44. Gosub avanzarmotor1
  45. Gosub ecribirletra
  46. Gosub ecribirletra
  47. fila = 0
  48. fila2 = 0
  49. fila3 = 0
  50. fila4 = 0
  51. fila5 = 0
  52. Gosub ecribirletra
  53. Gosub ecribirletra
  54.  
  55. 'aca empieza el codigo
  56.  
  57. 'aca termina el codigo
  58.  
  59. fila = 0
  60. fila2 = 0
  61. fila3 = 0
  62. fila4 = 0
  63.  
  64. Goto botones
  65.  
  66. End
  67.  
  68. ecribirletra:
  69.  
  70. If fila5.7 = True Then
  71. Gosub bajarlapicera
  72. Endif
  73. Gosub moverhorizontal
  74. If fila5.6 = True Then
  75. Gosub bajarlapicera
  76. Endif
  77. Gosub moverhorizontal
  78. If fila5.5 = True Then
  79. Gosub bajarlapicera
  80. Endif
  81. Gosub moverhorizontal
  82. If fila5.4 = True Then
  83. Gosub bajarlapicera
  84. Endif
  85. Gosub moverhorizontal
  86. If fila5.3 = True Then
  87. Gosub bajarlapicera
  88. Endif
  89. Gosub moverhorizontal
  90. If fila5.2 = True Then
  91. Gosub bajarlapicera
  92. Endif
  93. Gosub moverhorizontal
  94. If fila5.1 = True Then
  95. Gosub bajarlapicera
  96. Endif
  97. Gosub moverhorizontal
  98. If fila5.0 = True Then
  99. Gosub bajarlapicera
  100. Endif
  101. Gosub moverhorizontal
  102. If fila4.7 = True Then
  103. Gosub bajarlapicera
  104. Endif
  105. Gosub moverhorizontal
  106. If fila4.6 = True Then
  107. Gosub bajarlapicera
  108. Endif
  109. Gosub moverhorizontal
  110. If fila4.5 = True Then
  111. Gosub bajarlapicera
  112. Endif
  113. Gosub moverhorizontal
  114. If fila4.4 = True Then
  115. Gosub bajarlapicera
  116. Endif
  117. Gosub moverhorizontal
  118. If fila4.3 = True Then
  119. Gosub bajarlapicera
  120. Endif
  121. Gosub moverhorizontal
  122. If fila4.2 = True Then
  123. Gosub bajarlapicera
  124. Endif
  125. Gosub moverhorizontal
  126. If fila4.1 = True Then
  127. Gosub bajarlapicera
  128. Endif
  129. Gosub moverhorizontal
  130. If fila4.0 = True Then
  131. Gosub bajarlapicera
  132. Endif
  133. Gosub moverhorizontal
  134. If fila3.7 = True Then
  135. Gosub bajarlapicera
  136. Endif
  137. Gosub moverhorizontal
  138. If fila3.6 = True Then
  139. Gosub bajarlapicera
  140. Endif
  141. Gosub moverhorizontal
  142. If fila3.5 = True Then
  143. Gosub bajarlapicera
  144. Endif
  145. Gosub moverhorizontal
  146. If fila3.4 = True Then
  147. Gosub bajarlapicera
  148. Endif
  149. Gosub moverhorizontal
  150. If fila3.3 = True Then
  151. Gosub bajarlapicera
  152. Endif
  153. Gosub moverhorizontal
  154. If fila3.2 = True Then
  155. Gosub bajarlapicera
  156. Endif
  157. Gosub moverhorizontal
  158. If fila3.1 = True Then
  159. Gosub bajarlapicera
  160. Endif
  161. Gosub moverhorizontal
  162. If fila3.0 = True Then
  163. Gosub bajarlapicera
  164. Endif
  165. Gosub moverhorizontal
  166. If fila2.7 = True Then
  167. Gosub bajarlapicera
  168. Endif
  169. Gosub moverhorizontal
  170. If fila2.6 = True Then
  171. Gosub bajarlapicera
  172. Endif
  173. Gosub moverhorizontal
  174. If fila2.5 = True Then
  175. Gosub bajarlapicera
  176. Endif
  177. Gosub moverhorizontal
  178. If fila2.4 = True Then
  179. Gosub bajarlapicera
  180. Endif
  181. Gosub moverhorizontal
  182. If fila2.3 = True Then
  183. Gosub bajarlapicera
  184. Endif
  185. Gosub moverhorizontal
  186. If fila2.2 = True Then
  187. Gosub bajarlapicera
  188. Endif
  189. Gosub moverhorizontal
  190. If fila2.1 = True Then
  191. Gosub bajarlapicera
  192. Endif
  193. Gosub moverhorizontal
  194. If fila2.0 = True Then
  195. Gosub bajarlapicera
  196. Endif
  197. Gosub moverhorizontal
  198. If fila.7 = True Then
  199. Gosub bajarlapicera
  200. Endif
  201. Gosub moverhorizontal
  202. If fila.6 = True Then
  203. Gosub bajarlapicera
  204. Endif
  205. Gosub moverhorizontal
  206. If fila.5 = True Then
  207. Gosub bajarlapicera
  208. Endif
  209. Gosub moverhorizontal
  210. If fila.4 = True Then
  211. Gosub bajarlapicera
  212. Endif
  213. Gosub moverhorizontal
  214. If fila.3 = True Then
  215. Gosub bajarlapicera
  216. Endif
  217. Gosub moverhorizontal
  218. If fila.2 = True Then
  219. Gosub bajarlapicera
  220. Endif
  221. Gosub moverhorizontal
  222. If fila.1 = True Then
  223. Gosub bajarlapicera
  224. Endif
  225. Gosub moverhorizontal
  226. If fila.0 = True Then
  227. Gosub bajarlapicera
  228. Endif
  229. Gosub volvertodo
  230. Gosub avanzarmotor1
  231. Return
  232.  
  233. bajarlapicera:
  234. motorpen1 = 1
  235. motorpen2 = 0
  236. WaitMs 102
  237. motorpen1 = 0
  238. motorpen2 = 1
  239. WaitMs 102
  240. motorpen1 = 0
  241. motorpen2 = 0
  242. WaitMs 102
  243. Return
  244.  
  245. moverhorizontal:
  246. bipo = bipo + 1
  247. If bipo = 5 Then bipo = 1
  248. PORTB = 0
  249. motora1 = 1
  250. motorb1 = 1
  251. WaitMs sleeppap
  252. PORTB = 0
  253. motora1 = 1
  254. motorb2 = 1
  255. WaitMs sleeppap
  256. PORTB = 0
  257. motora2 = 1
  258. motorb2 = 1
  259. WaitMs sleeppap
  260. PORTB = 0
  261. motora2 = 1
  262. motorb1 = 1
  263. WaitMs sleeppap
  264. PORTB = 0
  265. Return
  266.  
  267. moverhorizontalatras:
  268. bipo = bipo + 1
  269. If bipo = 5 Then bipo = 1
  270. PORTB = 0
  271. motora2 = 1
  272. motorb1 = 1
  273. WaitMs 6
  274. PORTB = 0
  275. motora2 = 1
  276. motorb2 = 1
  277. WaitMs 6
  278. PORTB = 0
  279. motora1 = 1
  280. motorb2 = 1
  281. WaitMs 6
  282. PORTB = 0
  283. motora1 = 1
  284. motorb1 = 1
  285. WaitMs 6
  286. PORTB = 0
  287. Return
  288.  
  289. volvertodo:
  290. Dim y As Byte
  291. For y = 0 To 41
  292. motora2 = 1
  293. motorb1 = 1
  294. WaitMs sleeppap
  295. PORTB = 0
  296. motora2 = 1
  297. motorb2 = 1
  298. WaitMs sleeppap
  299. PORTB = 0
  300. motora1 = 1
  301. motorb2 = 1
  302. WaitMs sleeppap
  303. PORTB = 0
  304. motora1 = 1
  305. motorb1 = 1
  306. WaitMs sleeppap
  307. PORTB = 0
  308. Next y
  309. PORTB = 0
  310. Return
  311.  
  312. avanzarmotor1:
  313. If cambio = True Then
  314. cambio = False
  315. Else
  316. cambio = True
  317. Endif
  318.  
  319. If cambio = True Then
  320. PORTB = 0
  321. bobina1 = 1
  322. WaitMs sleeptime
  323. PORTB = 0
  324. bobina1 = 1
  325. bobina2 = 1
  326. WaitMs sleeptime
  327. PORTB = 0
  328. bobina2 = 1
  329. WaitMs sleeptime
  330. PORTB = 0
  331. bobina2 = 1
  332. bobina3 = 1
  333. WaitMs sleeptime
  334. PORTB = 0
  335. Else
  336. PORTB = 0
  337. bobina3 = 1
  338. WaitMs sleeptime
  339. PORTB = 0
  340. bobina3 = 1
  341. bobina4 = 1
  342. WaitMs sleeptime
  343. PORTB = 0
  344. bobina4 = 1
  345. WaitMs sleeptime
  346. PORTB = 0
  347. bobina4 = 1
  348. bobina1 = 1
  349. WaitMs sleeptime
  350. PORTB = 0
  351. Endif
  352. Return
  353.  
  354. retrocedermotor1:
  355. If cambio = True Then
  356. cambio = False
  357. Else
  358. cambio = True
  359. Endif
  360. If cambio = True Then
  361. PORTB = 0
  362. bobina4 = 1
  363. WaitMs sleeptime
  364. PORTB = 0
  365. bobina3 = 1
  366. bobina4 = 1
  367. WaitMs sleeptime
  368. PORTB = 0
  369. bobina3 = 1
  370. WaitMs sleeptime
  371. PORTB = 0
  372. bobina2 = 1
  373. bobina3 = 1
  374. WaitMs sleeptime
  375. PORTB = 0
  376. Else
  377. PORTB = 0
  378. bobina2 = 1
  379. WaitMs sleeptime
  380. PORTB = 0
  381. bobina2 = 1
  382. bobina1 = 1
  383. WaitMs sleeptime
  384. PORTB = 0
  385. bobina1 = 1
  386. WaitMs sleeptime
  387. PORTB = 0
  388. bobina4 = 1
  389. bobina1 = 1
  390. WaitMs sleeptime
  391. PORTB = 0
  392. Endif
  393. Return
  394.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement