Pic Basic Pro and C#


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    May 2011
    Posts
    17

    Default Pic Basic Pro and C#

    Hello

    Is it possible to combine C# or C++ with Pic Basic Pro ?

    For example I have LED that is connected to PIC, and PIC is connected to PC via USB. So when I create window in C# or C++ with button can I implement code from PBP in C# or C++, or there is some sort of programming PIC in C# or C++ ?

    Thx

  2. #2
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default Re: Pic Basic Pro and C#

    Quote Originally Posted by CipiCips View Post
    Hello

    Is it possible to combine C# or C++ with Pic Basic Pro ?

    For example I have LED that is connected to PIC, and PIC is connected to PC via USB. So when I create window in C# or C++ with button can I implement code from PBP in C# or C++, or there is some sort of programming PIC in C# or C++ ?

    Thx
    No I don't think so.
    C is C and basic is basic although there may be some overlap.
    Both C and Basic compile to a common base of assembly however.

    Perhaps someone can reply with any code converter utilities which might be available.


    Norm

  3. #3
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: Pic Basic Pro and C#

    The way I understand the OP question is: Can I program my pc program in C or C++ and than control my led connected to a pic programmed in picbasic pro via USB port?

    If the question is I understand it then the answer is : Yes of course you can.

    Cheers

    Al.
    All progress began with an idea

  4. #4
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default Re: Pic Basic Pro and C#

    You can follow this example. Its in VB.net, but is very easy to convert to C#.
    http://www.picbasic.co.uk/forum/cont...-USB-to-VB.NET
    Thanks and Regards;
    Gadelhas

  5. #5
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default Re: Pic Basic Pro and C#

    Quote Originally Posted by aratti View Post
    The way I understand the OP question is: Can I program my pc program in C or C++ and than control my led connected to a pic programmed in picbasic pro via USB port?

    If the question is I understand it then the answer is : Yes of course you can.

    Cheers

    Al.
    It's true a PIC programmed in either C or Basic can communicate with any program written for a PC with serial or USB capabilities.
    Could the original poster please clarify the question?


    Norm

  6. #6
    Join Date
    May 2011
    Posts
    17


    Did you find this post helpful? Yes | No

    Default Re: Pic Basic Pro and C#

    I will try to define better my question

    First I have googled and find out that I cant program PIC in C++ or C#, I can only program it in MikroC, PBP, ect. softwares that are made for programming PIC controllers.
    Second what if I need to create window application (which can be created in C# and c++) and that application will control my LED, servo ect. which are connected to PIC that has embanded USB.

    So question will be how to implement PIC code to window application in c++ or c# so that will communicate wit PIC since I dont have library for PIC instructions in C++ or C# ?

    This link which GADELHAS provided (http://www.picbasic.co.uk/forum/cont...-USB-to-VB.NET) is awsome and thats what I am kinda looking for, but when I run over the code I am kinda confused caouse I see two codes 1 is for PIC and one is for Window, but how do you merge that two codes I see many DEFINES and INCLUDES, is there any book or tutorial that shows how to do that ?

  7. #7
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: Pic Basic Pro and C#

    It doesn't work that way. The PIC and the PC communicate over a protocol you choose or even make up. You implement the protocol in the language of choice at either end. Your PC program sends a message to the PIC program and vice versa. You do not execute any instructions across the link. So on the PIC you write a program that does something like "when I see the letter D has been sent to me, I send back Hello World". On the PC end the program does something like "send a D then get back a message and then display it".

  8. #8
    Join Date
    Dec 2012
    Location
    Tennessee
    Posts
    262


    Did you find this post helpful? Yes | No

    Default Re: Pic Basic Pro and C#

    using your C code and a serial port to send receive data from the PIC, its like communicating with 2 computers via null modem cable in the old days. I use VB.net and its got a prebuilt in control for serial communication, if your using visual c/c++ it should have that too. to communicate with PIC USB Ports you should have to use a HID.dll file to communicate I think. Not sure how to do this on C, but in microcode studio it has a HID maker.

    But I would try just interfacing with the PIC via serial port to get the understanding and your program in c working first then change the type of communication.
    Chris


    Any man who has accomplished anything in electronics at one time or another has said... " STOP! WAIT! NOOO! Dangit.... Oh Well, Time to start over..."

  9. #9
    Join Date
    May 2011
    Posts
    17


    Did you find this post helpful? Yes | No

    Default Re: Pic Basic Pro and C#

    aha

    thx for answer now I understand how that works and it is clear to me now. So program created in C++ or C# will send info to USB, and program for PIC will register that info from USB and do what ever he is program to do.

  10. #10
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default Re: Pic Basic Pro and C#

    Quote Originally Posted by CipiCips View Post
    aha

    thx for answer now I understand how that works and it is clear to me now. So program created in C++ or C# will send info to USB, and program for PIC will register that info from USB and do what ever he is program to do.
    I would start by sending out serial from a PIC programed with compiler of your choice to a PC serial port and run HyperTerminal which is found in windows in the start menu under accessories > communications.
    The sent text will display on the terminal screen.
    Hyperterminal can also be configured to send keystrokes back to the PIC with a receive routine for example to blink an LED if RX is "1".
    This is a major cool factor for a beginner programmer!


    Norm

Similar Threads

  1. More Pic basic pro maths help.
    By retepsnikrep in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 10th February 2011, 06:09
  2. serial interface pic 18f452 using pic basic pro
    By syed ahmed in forum Serial
    Replies: 0
    Last Post: - 16th May 2010, 05:46
  3. Replies: 5
    Last Post: - 17th January 2006, 19:26
  4. Pic Basic Pro Syntax
    By Finn in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 26th January 2004, 18:07
  5. help pic basic pro
    By f6ggy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th September 2003, 00:55

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts