Author Topic: Possibility for converting PICBASIC to C in BCX  (Read 807 times)

magn4258

  • Newbie
  • *
  • Posts: 2
    • View Profile
Possibility for converting PICBASIC to C in BCX
« on: April 18, 2023, 01:39:03 AM »
Hey everyone

I got some code written with PICBASIC PRO compiler, and I want to know if it is possible to convert the BASIC to C with the BCX converter?

If it is possible it would be nice with some help on how to do it, I have downloaded BCX to my PC but have no idea how to do a simple conversion.

Thanks in advance.

djsb

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Re: Possibility for converting PICBASIC to C in BCX
« Reply #1 on: April 18, 2023, 05:17:06 AM »
No. BCX only converts its own dialect of BASIC into C code compatible with running on a PC that can run the Windows API. I don't know of ANY PIC microcontroller Basic to C convertors that can target a PIC microcontroller. Maybe you would be better off using the assembly language output of your PICBASIC PRO compiler and then including this assembly listing into your C code. This assembly listing can be put INLINE in C compilers such as CCS C or Microchips XC8,XC16 or XC32 range of C compilers (as well as others I have not used).




PS I'm not familiar with PICBASIC Pro.
« Last Edit: April 18, 2023, 05:20:50 AM by djsb »

magn4258

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Possibility for converting PICBASIC to C in BCX
« Reply #2 on: April 18, 2023, 05:43:07 AM »
Okay thanks for the reply, I'll se what I can do, else I just have to do it by hand.

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 2039
    • View Profile
Re: Possibility for converting PICBASIC to C in BCX
« Reply #3 on: April 18, 2023, 08:20:39 AM »
Greetings and welcome to the BCX forum.

Moments ago I spent a few minutes on the PICBASIC PRO forum browsing some source code.

I observed a number of non-standard BASIC syntax in the PICBASIC language that would require a specialized BASIC to C/C++ translator.  I've used BCX to translate a lot of code fragments written in QuickBasic, PowerBasic, Visual Basic and a few others requiring only minor changes.  PICBASIC would be much more challenging.

I've attached a PICBASIC source picked randomly from their forum and a quick BCX translation of it.  I promise you, it will not compile with any C/C++ compiler in the universe but it will give you a sense of what BCX tries to do for you.


 

iancasey

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: Possibility for converting PICBASIC to C in BCX
« Reply #4 on: April 18, 2023, 11:14:49 AM »
Take a look at MicroCode Studio, PICBASIC Pro, its been a while since I used it.
But I think it translates to assembly but there some options

Ian