Programming help

Status
Not open for further replies.

JmacHS

New Member
Hi all,

I am a year 12 student in Sydney currently completing my Design and Technology major work. A very small part of my project requires me to edit some code that was provided with a kit i purchased. Although this code will only drive the stepper which powers my project (it is a clock), it needed some small changes.

I have now made these changes but i have zero experience with programming microcontrollers. I have soldered the kit together, edited the code and purchases a PIC programmer (i am using a PIC16F628A). However i am completely out of my depth as to how to convert it from a .bas to a .hex file. I have downloaded multiple assemblers and compilers without any luck but the due date is approaching as are my trial and HSC exams and i am beginning to freak out.

The .bas file is attached, please note this is not my code.

If anyone could help me with my problem in any way i would greatly appreciate it.
 
You need the exact same compiler that the code is written for - you may need to ask the author what it uses, bear in mind you will probably have to BUY the compiler, which won't be cheap.
 
Thank you very much for your quick response, it is much appreciated.

The code was written in PBP3. I have downloaded this and after making my changes clicked compile. I however do not see any hex files anywhere. I have somehow made an .asm file however I have no idea how I can then convert this to a hex file. I would really prefer not to have to purchase a $150 piece of software for one compile to never be used again....it's a bit expensive...

Is it at all possible to now use mplabs IDE now I have an assembly file? Or are these still "attached" to the creating program?

My apologies for asking such basic questions, and once again thank you very much for your help.
 
Alan links PBPro on his web site **broken link removed** so I should imagine thats the compiler he uses..

Sorry missed the last post..... You can port it to great cow basic.. thats free.
 
Last edited:
Thank you very much for your response. I attempted to use this software earlier however when I copy and paste the code there are no options to select the device (which it asks for upon compiling). When I move to icon mode it has these options, but the commands are not recognized

Also, is there anything in particular that I am missing in PBP3? I have the trial and even when I compile Alan's bas file or php file I get the same results as I have with my own?
 
Not sure what they have done, I downloaded PBP3.06 trial and tried to compile this, got a shed load of assembler illegal opcode errors!

Last time I used PBP was 2.50 and it just seemed to work, people have reported problems with 2.60+
 
Thank you all for your help. I have attached the asm file that i mentioned, however to be honest i have not idea if it is actually in any way functional. Every time i have tried to compile i get errors so most likely this is buggy.

Wilksey, yes i have been wondering this also. Even when i attempt to compile Alan's php file or bas file it gives me a ridiculous amount of errors. As this is the program Alan has advised me to use, along with the fact that he definitely knows his stuff, i would take a guess that something else is going on. Basically the only edits i have made are changing a few numbers. I completed 2 years of visual basic programming at school and while i could never rewrite this program, i am able to follow it to ensure that nothing i have done would effect it.

Is there anywhere i could possibly download an evaluation copy of PBP2? I am really stuck on this and my final exams are approaching so i am very anxious to complete this small part of my project, i am happy to try anything

Thank you again for you help
 
Ok,

The reason is that PBP 3 has dropped support for the PM assembler, but let things in for backwards compatibility etc, so the @ DEVICE statements do not work for MPASM (the default assembler for PBP3), you have to use the "__config" code, which, if you try to use @__config will tell you that you are overwriting address 2007 as it has put default values into the code already.

Change the BAS file to the below code and it will compile with 0 errors + warnings.
Code:
    #CONFIG 
        __CONFIG _HS_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON & _LVP_OFF & _CP_OFF & DATA_CP_OFF
    #ENDCONFIG    
    ' System Clock Options 
    '@ DEVICE pic16F628A, HS_OSC
    ' Watchdog Timer 
    '@ DEVICE pic16F628A, WDT_ON 
    ' Power-On Timer 
    '@ DEVICE pic16F628A, PWRT_ON 
    ' Master Clear Options (Internal) 
    '@ DEVICE pic16F628A, MCLR_OFF 
    ' Brown-Out Detect 
    '@ DEVICE pic16F628A, BOD_ON 
    ' Low-Voltage Programming 
    '@ DEVICE pic16F628A, LVP_OFF 
    ' Data Memory Code Protect 
    '@ DEVICE pic16F628A, CPD_OFF 
    ' Program Code Protection 
    '@ DEVICE pic16F628A, PROTECT_OFF

Basically, comment out the "@ DEVICE xxxxx, xxxxx" lines, and add the "'#CONFIG/#ENDCONFIG" block to the code below the header comments.

Hope this helps you, please let us know how you got on.

Regards

Wilksey
 

Thank you so much for your help. I made the changes you suggested and it worked first time. Now I have the issue of making the code do what I want when I run the edited code the stepper just locks and doesn't move every second as it should. Oh well I guess thats tomorrows work

Anyway thank you all very much for your assistance and suggestions, it is very much appreciated
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…