Menu

how to use a complete assemble with Cow Basic

2024-06-25
2024-09-04
  • OSVALDO  HOJVAT

    OSVALDO HOJVAT - 2024-06-25

    I have a long assembler program with PIC16F1825 working ok. There are 6500 lines of code
    Because availability problems I buyed some qty of PIC18f04Q41 because it was mentioned in MPLAB 5.35 as it be included in this version.

    The problem is that after working with the many diferences I try to do some tests and found there is not included the assembler for this part in 5.35 and also not in any MPLABX version

    How can I use Cow Basic for this case ?

    I would apreciate any help

     
  • Anobium

    Anobium - 2024-06-26

    GCBASIC can resolve. Many methods.

    1. 6500 lines of code. What does it do ? Rewrite into GCBASIC then you have portable code to any microcontroller. 6.5k lines of ASM would be relatively easy to port.
    2. The latest version of MPASM is 5.87 not 5.35. Download the latest version from the FILES tab of this forum. Then, change add Q41 to MPASM and then use MPASM.
    3. Install 5.87
    4. Manually edit the 8bit_device.info to replace an existing microcontroller entry with the Q41
    5. Download the INC from the GBCASIC for the Q41 from GitHub
    6. Compile.
     
  • OSVALDO  HOJVAT

    OSVALDO HOJVAT - 2024-09-03

    Thank you for your reply
    I found your reply just today - perhaps I didn´t check "Subscribe to this topic "
    We are a two old people team makeing small qtys of parts for trains models (www.LDHtrenes.com.ar)
    The mentioned 6.5K program is for a DCC sound decoder (NMRA rules)
    It is doing a lot of jobs, with 32MHz clock
    Detect DCC protocol for ligths and motor control
    Sintetizing sounds for Diesel motors or vapor locomotives
    bell trump whistle compresor
    With the pic18part , with hardware multiplication and 64MHz clock, I can improve some of the sounds.
    A couple of years ago I moved the asm program to pic18f26q10 for more pins count to handing a flash memory with recorded sounds, plus the sintetized sounds
    I had no notice of Cow Basic at this moment.
    Now moving again the .asm to ...q41 is also hard but the MPLABX5.35 that includes ASSEMBLER 5.87 had not the ...q41.inc , but worst, it lacks other file ( I don´t remember the name at the moment ...dfp ?) needed for compiling
    Please let me know if it may be more easy to learn Cow Basic and re-write the program or
    to fix the MPlabX 5.87 for the pic18f04q41 ( if posible) and
    MOVE A LOT of Conmmon Registers and SFR to different pages
    This part is very different to original pic16f1825 and also to pic18f26q10 used before

    Best Regards, Osvaldo

     
  • Anobium

    Anobium - 2024-09-03

    Personally, I would rewrite. There is no support for my idea. I did a search and no one is doing this.

    I have interest in the DCC protocol - so, get started. :-)

    Are you sure about the Q41 ? There are better chips and cheaper. https://www.amazon.co.uk/OSOYOO-LGT8F328P-Compatible-ATmega328p-Interface/dp/B0BDM3FHF2 And, the LGT support much higher currents.

    The concept of GCBASIC is to remove the complexity. Registers, SFR page management is all resolved. I truly believe that you can do more faster in GCBASIC rather than ASM.

    Have a look at this source. https://github.com/GreatCowBASIC/Demonstration_Sources/blob/main/Vendor_Boards/Microchip_PICDEM_2_plus_board/20_Capability_demo.gcb This is shown how to use a lot of capabilities.

    • Lesson 1: Hello World (Turn On an LED)
    • Lesson 2: Blink
    • Lesson 3: Rotate (Moving the Light Across LEDs)
    • Lesson 4: Analog-to-Digital Conversion (ADC)
    • Lesson 5: Variable Speed Rotate
    • Lesson 6: Debounce
    • Lesson 7: Pulse-Width Modulation (PWM)
    • Lesson 8: Timer1
    • Lesson 9: Interrupts
    • Lesson 10: Sleep/Wakeup
    • Lesson 11: EEPROM Memory Operations
    • Lesson 12: LCD Operations
    • Lesson 13: NVM Memory Operations
    • Lesson 14: I2C Discovery
    • Lesson 15: I2CTemperature     
    • Lesson 16: I2CEEPROM      
    • Lesson 17: CLOCK - basic tick-tock 
    • Lesson 18: Buzzer
    

    Now consider the ASM, with no comments ( I removed them as this give 12.5k lines of code ). The 9k lines of ASM code is created directly from the GCBASIC source. And, GCBASIC assembles also. See https://github.com/GreatCowBASIC/Demonstration_Sources/blob/main/Vendor_Boards/Microchip_PICDEM_2_plus_board/20_Capability_demo.asm

    Regarding the Maths. GCBASIC will use the maths capability, if present in the chip, or it will use the robust routines.

    Totally your call. But, you can use MPLAB-X. :-)

     

    Last edit: Anobium 2024-09-03
  • OSVALDO  HOJVAT

    OSVALDO HOJVAT - 2024-09-04

    If I may had this GCBASIC information about 3 years ago , most probabely I will choosed to re-write the program before moving to pic18F26Q10
    At the moment the only problem is we have in stock 200 parts of pic18F04Q41
    buyed near 20 months ago at price about u$ 1.00 . At this moment current used part pic16f1825 had no delivery for1 year.
    But we will get in short 200 parts of the usually used PIC16F1825
    They are 14 pins SMD totally compatible for the PCB.

    At the moment I am very busy finishing a proyect: changing RS485 cable conexion between hand-held controller and the Command Station , to a RF link using low cost NRF24L01 based board, so any matter with the PIC18F04Q41 will be delayed.
    I used assembler from the begining and not any C librarys
    I got a lot of support from NRF manufacturer forum

    I will begin with GCBASIC learning later

    I think there is no a "magic" solution as de -compiling program memory list or .hex for used procesor PIC16F1825 to a source GCBASIC , and later compiling it for PIC18F04Q41 part


    About yor interest about DCC there are available information in Paco Cañada site and also in other places MERG , JMRI about train control from a PC
    There is an old SHOWDCC program only for WindowsXP that I have a copy . Simple hardware needed.

    Best Regards, Osvaldo

     
  • Anobium

    Anobium - 2024-09-04

    Good to hear the plan.

    At least the GCBASIC will be portable across 1825 to Q41 - sometimes with very little code changes.

    Cheers.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.