![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
I recently picked up a copy of Picbasic and have been testing some sample files through it to see how it converts. I am seeing some asm that doesn't look right. I'm pretty new to asm but I will let you guys take a look: PB code in sample: Code: Include "modedefs.bas" ' Include serial modes SO con 0 ' Define serial output pin B con 5 ' Define Button input pin B0 var byte B0 = 0 ' Zero Button Working Buffer loop: Button B,1,10,5,B0,0,notp ' Check Button (Skip if Not Pressed) Serout SO,N2400,["Press",13,10] ' Indicate Button Pressed notp: Serout SO,N2400,[#B0,13,10] ' Show Working Variable Pause 100 ' Visual Pause Goto loop Code: INCLUDE "16F628A.INC" RAM_START EQU 00020h RAM_END EQU 0014Fh RAM_BANKS EQU 00003h BANK0_START EQU 00020h BANK0_END EQU 0007Fh BANK1_START EQU 000A0h BANK1_END EQU 000EFh BANK2_START EQU 00120h BANK2_END EQU 0014Fh EEPROM_START EQU 02100h EEPROM_END EQU 0217Fh R0 EQU RAM_START + 000h R1 EQU RAM_START + 002h R2 EQU RAM_START + 004h R3 EQU RAM_START + 006h R4 EQU RAM_START + 008h R5 EQU RAM_START + 00Ah R6 EQU RAM_START + 00Ch R7 EQU RAM_START + 00Eh R8 EQU RAM_START + 010h FLAGS EQU RAM_START + 012h GOP EQU RAM_START + 013h RM1 EQU RAM_START + 014h RM2 EQU RAM_START + 015h RR1 EQU RAM_START + 016h RR2 EQU RAM_START + 017h _B0 EQU RAM_START + 018h _PORTL EQU PORTB _PORTH EQU PORTA _TRISL EQU TRISB _TRISH EQU TRISA ; Constants. _T2400 EQU 00000h _T1200 EQU 00001h _T9600 EQU 00002h _T300 EQU 00003h _N2400 EQU 00004h _N1200 EQU 00005h _N9600 EQU 00006h _N300 EQU 00007h _OT2400 EQU 00008h _OT1200 EQU 00009h _OT9600 EQU 0000Ah _OT300 EQU 0000Bh _ON2400 EQU 0000Ch _ON1200 EQU 0000Dh _ON9600 EQU 0000Eh _ON300 EQU 0000Fh _MSBPRE EQU 00000h _LSBPRE EQU 00001h _MSBPOST EQU 00002h _LSBPOST EQU 00003h _LSBFIRST EQU 00000h _MSBFIRST EQU 00001h _CLS EQU 00000h _HOME EQU 00001h _BELL EQU 00007h _BKSP EQU 00008h _TAB EQU 00009h _CR EQU 0000Dh _UnitOn EQU 00012h _UnitOff EQU 0001Ah _UnitsOff EQU 0001Ch _LightsOn EQU 00014h _LightsOff EQU 00010h _Dim EQU 0001Eh _Bright EQU 00016h _SO EQU 00000h _B EQU 00005h INCLUDE "BUTTON.MAC" INCLUDE "PBPPIC14.LIB" MOVE?CB 000h, _B0 LABEL?L _loop BUTTONPIN?C _B BUTTONDS?C 001h BUTTONDEL?C 00Ah BUTTONRATE?C 005h BUTTONTS?C 000h BUTTON?BL _B0, _notp SERPIN?C _SO SERMODE?C _N2400 SEROUT?C 050h SEROUT?C 072h SEROUT?C 065h SEROUT?C 073h SEROUT?C 073h SEROUT?C 00Dh SEROUT?C 00Ah LABEL?L _notp SERPIN?C _SO SERMODE?C _N2400 SEROUTD?B _B0 SEROUT?C 00Dh SEROUT?C 00Ah PAUSE?C 064h GOTO?L _loop END | |
| |
| | #2 |
|
Notice there are two include files there, macros and a library - I suspect those make sense out of what's there.
| |
| |
| | #3 |
|
Why are you trying to take apart a basic compilers results? It's going to be hard to read, compilers don't do things like people do.
__________________ "Because I be what I be. I would tell you what you want to know if I could, mum, but I be a cat, and no cat anywhere ever gave anyone a straight answer, har har." Last edited by Sceadwian; 30th May 2009 at 09:15 PM. | |
| |
| | #4 | |
|
The Basic compilers will out put pages of includes in assembly views and only use 10 or 20 lines in the code and it never looks like assembly to me If you want to no Quote:
in asm | ||
| |
| | #5 |
|
Especially if you use math routines. The ASM is gonna be a nightmare.
__________________ "Because I be what I be. I would tell you what you want to know if I could, mum, but I be a cat, and no cat anywhere ever gave anyone a straight answer, har har." | |
| |
| | #6 |
|
As long as it is valid ASM. I have used basic for years and feel more comfortable with it. However, I am still going to learn asm better. This is part of the asm that looks "funny". Code: SEROUT?C 00Ah PAUSE?C 064h | |
| |
| | #7 |
|
It just loading some values from ram But like I said it's easier to learn assemble then to read that. It sending what at (00Ah) and if it reads (064h) It done is all I can tell from that | |
| |
| | #8 | |
| Quote:
SEROUT?C 00Ah send 0A hex serially, PAUSE?C 064h is your PAUSE 100.
__________________ Steve | ||
| |
| | #9 |
|
As long as it converts to hex for programming. Would I just use MPlab and convert this to a hex file? Sorry it has been a while with programming pics.
| |
| |
| | #10 | |
|
Mplab It will not convert a asm from pic basic to a hex assemby has no idea what Quote:
Code: #include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
org 0
Start:
bsf STATUS,RP0 ; select Register Page 1
bcf TRISC,0 ; make IO Pin C0 an output
bcf STATUS,RP0 ; back to Register Page 0
bsf PORTC,0 ; turn on LED C0 (DS1)
goto $ ; wait here
end
| ||
| |
| | #11 |
| PIC BASIC directly generates a HEX file.
| |
| |
| | #12 | |
| Quote:
| ||
| |
|
| Tags |
| basic, pic |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| IF B0 < 0 !?!?! in PIC Basic | arvinfx | Micro Controllers | 25 | 20th December 2008 04:28 PM |
| Basic Help | teknician | General Electronics Chat | 9 | 18th December 2007 10:50 PM |
| Free BASIC compilers Visual BASIC Express vs JustBASIC? | William At MyBlueRoom | General Electronics Chat | 5 | 4th January 2007 04:51 AM |
| PIC basic and Basic stamp | Cyborg | Micro Controllers | 5 | 21st April 2004 09:44 AM |
| Pic Basic Help! | dengdiego | Micro Controllers | 0 | 23rd March 2004 10:17 PM |