Menu

Pickit2 and GCB terminal

Help
2017-04-02
2017-04-02
1 2 > >> (Page 1 of 2)
  • stan cartwright

    stan cartwright - 2017-04-02

    Hi. I'm programming a 18f25k22 in circuit with pickit 2 and GCB and used this code to read values in GCB terminal but it's not the same as a uno. Any advice welcome.

    #define USART_BAUD_RATE 9600
    #define USART_TX_BLOCKING
    do
    get_range
    HSerPrint "Distance= "
    HSerPrint range
    HSerPrint " CM"
    HSerPrintCRLF
    wait 100 ms
    loop
    
     
  • Anobium

    Anobium - 2017-04-02

    .... and, what is happening? Can't guess what is not working. ....

     
  • William Roth

    William Roth - 2017-04-02

    Can't determine much without complete code and a precise description of the problem.

     
  • Chris Roper

    Chris Roper - 2017-04-02

    I would hazard a guess that Stan expects the PICKit 2 to act as a USB-Serial Adapter with the terminal using the same pins.

    If I am making a bad assumption, please ignore me, but this may be useful info for others moving from Arduino to PIC.

    That won't work with the PICKit.

    The Arduino has a Serial Bootloader whilst the PICKit is a Hardware Programmer.

    You will need a USB/serial adapter connected to your 18f25k22 PIC's serial port in order to use the Terminal.

    There are Bootloaders available for several PIC's but you would still have to program it with the PICKit the first time to install the bootloader and you will still need the USB/serial adapter . But once the Bootloader is installed you will be able to program Via the USB/serial adapter as you do the Arduino.

    Cheers
    Chris

     

    Last edit: Chris Roper 2017-04-02
    • Chuck Hellebuyck

      If you use the PICkit2 GUI then it has a built in terminal that connects through the programming pins. It works similar to the ARDUINO terminal window. It can even capture .csv data for import into excel.

       
      • Anobium

        Anobium - 2017-04-02

        And, so will Pickit3 hopefully. I have started to update Pickit3 to support serial and the new family of chips. I will create a new Sourceforge site very soon.

        😀

         
  • Anobium

    Anobium - 2017-04-02

    My guess.. I don't have one. Insufficient information.

    But, we can but play.

    He still has the serial cable hooked up to the Uno? Only joking.

     
  • William Roth

    William Roth - 2017-04-02

    The batteries in my crystal ball have died, I am clueless,

     
  • stan cartwright

    stan cartwright - 2017-04-02

    Thanks all. Chris was correct. I thought boot loaders were just for serial programming. I had seen the pickit2 terminal being used and references to mplabx on google. I was using a zif socket but icp is just like programming a unu board. I suppose if I'd just bought a 328p chip I'd have to program the arduino boot loader first to use a terminal.
    I've seen usb to rs232 adaptors recommended so I'll get some anyway. At the moment I'm ok with pickit 2 but should I get a pickit 3 clone?
    If I download a bootloader, do I just flash it, then just program the chip as normal or are there any other considerations?
    It's all new to me. I used home made parallel printer programmers once but they're obsolete now.

     
  • stan cartwright

    stan cartwright - 2017-04-02

    ps "18f25k22 PIC's serial port" means not the programming clock/data but RA4/RA5. Sorry to mention but that's the pins picaxe uses and I have a rs232 lead, tx/rx/ground. They use 2 resistors to make it compatable with laptops with poor rs232.
    Could I use that lead to use the terminal? All seems a lot of messing around.

     
  • stan cartwright

    stan cartwright - 2017-04-02

    I'll use a lcd for now.

     
  • William Roth

    William Roth - 2017-04-02

    Stan,

    You should not equate Picaxe stuff with PIC stuff. If you do you will likely be wrong. Picaxe terminolgy does not generally apply to PIC or Great Cow Basic. So it's a good idea to forget Picaxe stuff when dealing with PICs and Great cow Basic.

    ps "18f25k22 PIC's serial port" means not the programming clock/data but RA4/RA5.

    This is incorrect.

    Picaxe does not use a serial port for programming, It uses bit-banged software serial on RA4/RA5. The fact that Picaxe uses A4/A/5 for programming does mean they use a serial port. A quick look at the 18F25K22 datasheet shows that RA4/RA5 are not assigned to a serial port. The 18F25K22 has 2 hardware serial ports (USARTS) Port1 uses RC6/RC7 and Port2 uses RB6/RB7.

    To use hardware serial to send data to the terminal app is rather simple. If you have a real serial RS232 Port on your computer use RC6 (PIN 17) for TX to the terminal this can be directly connected to the PC's RS232- RX. You will need to Set the SCKP bit "ON" in GCB source code to invert the TX data.

    However, DO NOT connect the RS232 TX from the PC directly to PIC USART RX (Pin 18) as the voltage is too high. But it can be connected in the same manner as the Picaxe Download Circuit ( 2 resistors). PIC RX does not need to be connected to send data to the terminal. I use a serial cable with on end cut off and flying leads soldered on for GND, RX, TX, RTS, & DTR. (RTS or DTR can be used for serial programming with a bootloader)

    If the PC does not have a serial port, then use a USB/TTL adapter that creates a Virtual Com PORT. . It is not necessary SET the SCKP bit of the BAUDCON Register when using a USB/TTL adapter. If you get a USB/TTL adapter, MAKE SURE that it brings out either RTS or DTR to allow serial programming with "TinyBootloader+" included with Great Cow Basic.

     
  • stan cartwright

    stan cartwright - 2017-04-03

    Thanks Evan. I'll look in serial solutions in GCB demos.I used a lcd. Serial communication terminology is new to me. It distracted me for a day looking at serial and bootloaders. I've never used rs232,maybe a mouse once and usb is just plug and play to me (when the drivers work!)

     
  • CDRIVE

    CDRIVE - 2017-04-03

    Stan, just a clarification here. The AXE027 programming cable is a USB/RS232(TTL) device. In other words The PC sees it as an RS232 CommPort. Unlike generic USB/RS232 converters the mini plug end of the cable does not produce standard RS232 voltage levels. The RX pin swings between 0V and +5V. IE, it never goes negative. This makes it a USB/RS232/TTL converter but it lacks all the control pins that utilize RS232 protocol. I've used it with VB6 (MSComm) like any other USB/RS232 converter (I have 4 of them) but using Software Flow Control only. This is because Hardware Flow Control requires use of the standard RS232 control pins.

    So while you can't program a PIC with it you can use it with a Terminal for serial programs that don't require the control pins.

    BTW, I peeked at the Ebay listings for USB/RS232/TTL converters. They're quite afordable and provide all the control pins required to satisfy RS232 standards.

    Chris

     
  • Anobium

    Anobium - 2017-04-03

    @CDRIVE.   100% agree. I have am AXE027 hooked up on my test bench. Works via TTL inverter I built. ... now 5 years later I realise what a waste of my time to build that.... just by a converter from USB. 😀

     
  • CDRIVE

    CDRIVE - 2017-04-03

    Yeah Evan, I would imagine that direct USB/RS232/TTL converters (for the most part) puts the Max232 out of business too. I have quite a few USB/RS232 converters but I'm going to buy one of those ebay TTL models. I'm a China's Ebay junky! ;-)

    Cheers,
    Chris

     
  • William Roth

    William Roth - 2017-04-04

    If you are not programming Picaxe Chips, you can download and run FTPROG on the AX027 ( or any genuine and some fake FTDI adapters) and change the TX & RX idle state. The FTDI chips are the only ones that are user programmable to invert or not invert the serial data.

    Unfortunately most of the FTDI USB/TTL devices sold on Ebay are counterfeit/fake and FTPROG doe not work on some of these. . .

     
  • CDRIVE

    CDRIVE - 2017-04-04

    William, thanks for the FTDI chip info. I was unaware of that.

    Chris

     
  • William Roth

    William Roth - 2017-04-05

    Probably a fake/counterfeit as it looks/appears identical to other boards on EBAY costing as little as $1.49.

    Given that an FT232RL chip alone costs $2.50 each in quantities of 2000 it is not likely that a genuine FTDI chip is used on a product costing less than the wholesale price of the chip.

    I have flashed my AXE027 (Genuine FTDI Chip) at least 50 times and not bricked yet. Same with a genuine FTDI adapter from 4DSystems. Flashing with FTPROG is no more risky than updating the BIOS on a PC or any other device.

    Many folks, (becasue of cheap prices) knowingly abandon their normally good ethics by supporting these counterfeiters... Yet I imagine these same folks would scream "foul" if someone stole their design, used substandard parts and sold it as the real deal for 1/4 the price.

    http://www.starlino.com/ftdi-chip-real-of-fake-how-to-spot-a-fake-rt232r-rt232rl-and-others.html

    https://thecounterfeitreport.com/product/562/FTDI--Chip-FT232RL-Chips.html

     

    Last edit: William Roth 2017-04-05
  • William Roth

    William Roth - 2017-04-05

    Here is that same board listed on Amazon. Note that it states "Not genuine FTDI chip" in the description. Yet the chip is stamped "FTDI"

     
  • stan cartwright

    stan cartwright - 2017-04-05

    HI people. I ordered 1 of these but 3 quid to arrive in a week. http://www.ebay.co.uk/itm/like/152037156660?chn=ps&adgroupid=39613511478&rlsatarget=aud-292456216308%3Apla-279121852961&abcId=923836&adtype=pla&merchantid=110387893&poi=&googleloc=1007416&device=c&campaignid=737386489&crdt=0 I got a real rs232 port so why not just write vars to it? From a pin that does that and serial solutions in demos. Boot loader programming was not my intention.Is this converter going to catch fire? I never used debug,just write vars. It's all new to me. A glcd is fine with the GCB GLCD lib. Very nice and easy i2c if terminal is out. That's what I used for pic. Uno terminal. See what the postie brings.

     
    • William Roth

      William Roth - 2017-04-05

      That adapter should work fine. It also brings out DTR and RTS so it should also work with TinyBootloader App. I have had good experience with CP2102 based devices.

       
1 2 > >> (Page 1 of 2)

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.