Using the Velleman K8048 or K8076 PIC Programmer in
FreeBSD, NetBSD, Linux, Cygwin (Windows) and MACOS/X (UNIX / POSIX)


Table of contents

K8048 K8076

Introduction

The application found here (k8048) has been written to allow programming of PICMicro devices in FreeBSD, NetBSD, Linux, Cygwin (Windows) and MACOS/X or any UNIX / POSIX based system with the Velleman K8048 or K8076 kits.

Cygwin

Cygwin for Windows.

In order to use this program in Cygwin for Windows you must first install and setup Cygwin including the necessary development tools for building the application. See Appendix A for details.

Two back-end methods are built-in to communicate with the programmers; The POSIX RS-232 serial protocol and the Raspberry Pi GPIO interface. RS-232 is available on every platform but R-PI GPIO is only available and only tested on RASPBIAN for the Raspberry Pi. The R-PI GPIO requires voltage level shifters and an example circuit for the K8048 is demonstrated in Appendix B of this document.

PCI

Intek21 PCI IO 2S-550.

USB

pl2303 USB serial converter.

RPI

Raspberry-Pi 'Ace'.

Below is the current status of interface support.

Hardware interface Status Device name
Motherboard 8250/16550 UART Works perfectly Generic
MCT U232 USB serial converter Not working Targus PA088
pl2303 USB serial converter Working (slowly) Best Connectivity (Dabs Value)
FTDI USB serial converter Not working ECS i-Buddie USB Dock
Raspberry Pi GPIO Works perfectly 74HC03 (voltage level shifting)
PCI LGS GM16C550 UART Works perfectly (Cygwin) Intek21 PCI IO 2S-550 Board

Testing with a standard serial UART has been done on FreeBSD and Linux, and a Prolific PL-2303 USB to serial adapter has been tested on MACOS/X by Tobias Braun who reported success (Thank you Tobias). I have also tested the Prolific along with Fred Marquis and we both report success with this device in Linux. However, although the Prolific device works, it is very slow and this is not resolvable due to usb control messages for this device taking a minimum of 3ms.

Before you download and use this application you should read the LICENSE found here. This license details the rights and liabilities of using the application and it should be especially understood that I, the author, will not accept any responsibility for any side effects of running it. IE. Do not download and run this program unless you are willing to accept the consequences of it failing for any reason.

10f220

A PIC10F220 connected via ICSP.

18F4550

A PIC18F4550 connected via ICSP.

16f648a

A PIC16F648A connected via ICSP.

At this time, the application is still work in progress, and a limited number of devices are supported. This is because I do not have access to many devices for evaluation and testing. The known supported devices are listed later in this document.

If you have no success with this application then it is most likely due to the above but you may find it easy to add support for your own device by editing a small number of source files, else you are welcome to send to me a sample device for testing and I will add it to the list of supported devices as soon as possible.

Please contact darron at kewl org with any diffs you have made to add support for another PICMicro device or alternatively contact me for details about where to send a sample. If you do send a sample device it will not be returned as it would be required for future debugging work.

Table of contents

Credits and thanks

This application was written by Darron M Broad in 2005, 2007, 2012 and 2013 and is an ongoing effort.

Thanks go to Ian Stoyle who supplied a patch which added support for the 16F84 and 16C84 devices that do not have device IDs embedded within their configuration. The patch was used to add a feature overriding the device probe and instead supplying the device name of the target.

Kristoffer Myskja reported that he had great success with the Windows tool on a laptop without serial I/O by using a cardbus serial interface. He did mean to test Linux at a later time, but it would seem that such an interface could be the best option for any laptop without a UART.

Johan Ahlander notified me that the application worked fine in NetBSD.

Working with keen linux user and PIC coder Paul Van Gelder I added support for the Velleman K8076 kit and 16F84A PICMicro. Thanks Paul! To use the application with the K8076 see the BITRULES option for the dot file below.

Many thanks to Chaitanya Rogers who donated money toward development and to acquire new PICmicros. All the PICMicros acquired with that donation are now supported, thank you.

Thank you Josef Larsson for reporting that the 16F690 is compatible with this application using ICSP. This device may also be used in the 14P socket with pins 8 to 13 unconnected.

Thanks go to David at RK Education as I now have a PIC18F27J53 to investigate. This was sent free of charge with a RKP28sb PIC kit. This PIC Micro isn't compatible with the Velleman K8048 but is a good candidate for a direct connection to the Raspberry Pi and low voltage programming. This feature will be added at a later time.

Lastly, thank you to Microchip for creating these versatile microcontrollers and also for their sample program which has supplied two devices.

Table of contents

Supported Devices

MICROCHIPS

PICMicros.

XINO

Xino Basic for PIC.

LED

PIC16F886 flashing LEDs.

The following devices are known to work.

Test Device name Added by Tested by Velleman K8048 notes
YPIC16F84ADarron BroadPaul Van Gelder 
YPIC16F627Darron Broad  
YPIC16F88Tobin Richard  
YPIC16F648ADarron Broad  
YPIC16F819Darron Broad  
YPIC16F676Darron Broad  
YPIC12F675Darron Broad  
YPIC16F877ADarron Broad ICSP only. PGC 100pf to GND.
YPIC18F1320Darron Broad PGM 10K to GND on 28P.
YPIC18F2550Darron Broad  
YPIC18F252Darron Broad  
YPIC16F716Darron Broad  
YPIC16F505Darron Broad  
YPIC10F200Darron Broad ICSP only. PGC 100pf to GND.
YPIC10F202Darron Broad ICSP only. PGC 100pf to GND.
YPIC18F4550Darron Broad ICSP only. PGC 100pf to GND.
YPIC18F2320Darron Broad  
YPIC12F683Darron Broad  
YPIC16F688Darron Broad  
YPIC16F628ADarron Broad  
YPIC16F726Darron Broad VPP 10V or 8K2 to GND on 8P.
YPIC12F508Darron Broad  
YPIC12F615Darron Broad  
YPIC16F872Darron Broad  
YPIC16F57Darron Broad ICSP only. PGC 100pf to GND.
YPIC16F54Darron Broad  
YPIC16F506Darron Broad  
YPIC10F220Darron Broad ICSP only. PGC 100pf to GND.
YPIC16F887Darron Broad ICSP only. PGC 100pf to GND.
YPIC12F519Darron Broad  
YPIC16F73Darron Broad  
YPIC10F320Darron Broad ICSP only. VPP 9V1. PGC 100pf to GND.
YPIC16F886Darron Broad  
YPIC16F1507Darron Broad Use 14P. VPP 9V1 or 6K8 to GND on 8P.
YPIC18F25K22Darron Broad VPP 9V1 or 6K8 to GND on 8P.
YPIC18F4620Darron Broad ICSP only. PGC 100pf to GND.
YPIC16F876ADarron Broad  
YPIC12F617Darron Broad  
YPIC18F4520Darron Broad ICSP only. PGC 100pf to GND.
NPIC16F1847Darron Broad  
NPIC16F1936Darron Broad  
NPIC16F873AChris Williams  
NPIC16F84Ian Stoyle  
NPIC16F690Darron BroadJosef LarssonUse 14P.

Full support list is as follows.

12-bit word / 8-bit data architecture

16f57

A PIC16F57.

 DS41226E
  PIC12F508 T PIC12F509 U PIC16F505 T
  
 DS41257B
  PIC12F510 U

 DS41258C
  PIC16F506 T
 
 DS41228D (see note 1)
  PIC10F200 T PIC10F202 T PIC10F204 U PIC10F206 U

 DS41266C (see note 1)
  PIC10F220 T PIC10F222 U

 DS41207D
  PIC16F54 T

 DS41208C (see note 1)
  PIC16F57 T

 DS41243B
  PIC16F59 U

 DS41316C
  PIC12F519 T

 T=TESTED
 U=UNTESTED

Notes

  1. These devices are not pin compatible with the K8048 and must be programmed via the ICSP header.

14-bit word / 8-bit data architecture

16f88

A PIC16F88.

 DS30262E
  PIC16F84A T

 DS30277D
  PIC16F627 T PIC16F628 U

 DS39025F
  PIC16F870 U PIC16F871 U PIC16F872 T PIC16F873 U
  PIC16F874 U PIC16F876 U PIC16F877 U

 DS39589B
  PIC16F873A T PIC16F874A U PIC16F876A T PIC16F877A T

 DS39607B
  PIC16F87 U PIC16F88 T

 DS41173C/DS41191C (see note 1)
  PIC12F629 U PIC12F675 T PIC16F630 U PIC16F676 T

 DS41196F
  PIC16F627A U PIC16F628A T PIC16F648A T

 DS39603C
  PIC16F818 U PIC16F819 T

 DS40245B (see note 2)
  PIC16F716 T

 DS41204G
  PIC12F635 U PIC12F683 T PIC16F631 U PIC16F636 U
  PIC16F639 U PIC16F677 U PIC16F684 U PIC16F685 U
  PIC16F687 U PIC16F688 T PIC16F689 U PIC16F690 T

 DS41332D (see note 3)
  PIC16F722 U PIC16F722A U PIC16F723 U PIC16F723A U
  PIC16F724 U PIC16F726  T PIC16F727 U

 DS41284E
  PIC12F615  T PIC12HV615 U PIC12F617  T PIC16F616 U
  PIC16HV616 U PIC12F609  U PIC12HV609 U PIC16F610 U
  PIC16HV610 U

 DS41287D
  PIC16F882 U PIC16F883 U PIC16F884 U PIC16F886 T
  PIC16F887 T

 DS30324B
  PIC16F73 T PIC16F74 U PIC16F76 U PIC16F77 U

 DS41572D (see notes 3 and 4)
  PIC10F320 T PIC10F322 U

 DS41573C (see note 3)
  PIC12F1501 U PIC16F1503 U PIC16F1507 T PIC16F1508 U
  PIC16F1509 U

 DS41439A (see note 3)
  PIC12F1840 U PIC16F1847 T

 DS41397B (see note 3)
  PIC16F1933 U PIC16F1934 U PIC16F1936 T PIC16F1937 U 
  PIC16F1938 U PIC16F1939 U PIC16F1946 U PIC16F1947 U 

 T=TESTED
 U=UNTESTED

Notes

  1. The bandgap bits and osccal word of PIC12F629/675 and PIC16F630/676 devices are preserved for each write without user intervention yet they should be retrieved and written down for safe keeping.
  2. The PIC16F716 must be power cycled before verification and since the K8048 cannot control the 5V rail the following steps must be performed.
    1. Program device.
    2. Switch to standby.
    3. Switch to prog.
    4. Verify device.
  3. These devices must be flashed with VPP at 9V. The simplest means to do this on a K8048 is to either connect a 9V1 zener diode or 6K8 resistor between pins 4 and 8 on the 8-pin PIC socket. See Appendix C.
  4. These devices are not pin compatible with the K8048 and must be programmed via the ICSP header.

16-bit word / 8-bit data architecture

18f2320

A PIC18F2320.

 DS39576B
  PIC18F242 U PIC18F248 U PIC18F252 T PIC18F258 U
  PIC18F442 U PIC18F448 U PIC18F452 U PIC18F458 U

 DS39592E
  PIC18F1220 U PIC18F1320 T PIC18F2220 U PIC18F2320 T
  PIC18F4220 U PIC18F4320 U

 DS39622K
  PIC18F2221 U PIC18F2321 U PIC18F2410 U PIC18F2420 U 
  PIC18F2423 U PIC18F2450 U PIC18F2455 U PIC18F2458 U
  PIC18F2480 U PIC18F2510 U PIC18F2515 U PIC18F2520 U
  PIC18F2523 U PIC18F2525 U PIC18F2550 T PIC18F2553 U
  PIC18F2580 U PIC18F2585 U PIC18F2610 U PIC18F2620 U
  PIC18F2680 U PIC18F2682 U PIC18F2685 U PIC18F4221 U
  PIC18F4321 U PIC18F4410 U PIC18F4420 U PIC18F4423 U
  PIC18F4450 U PIC18F4455 U PIC18F4458 U PIC18F4480 U
  PIC18F4510 U PIC18F4515 U PIC18F4520 T PIC18F4523 U
  PIC18F4525 U PIC18F4550 T PIC18F4553 U PIC18F4580 U
  PIC18F4585 U PIC18F4610 U PIC18F4620 T PIC18F4680 U
  PIC18F4682 U PIC18F4685 U

 DS39752A
  PIC18F1230 U PIC18F1330 U PIC18F1330-ICD U

 DS41398B (see note 1)
  PIC18F23K22 U PIC18F24K22 U PIC18F25K22 T PIC18F26K22 U
  PIC18F43K22 U PIC18F44K22 U PIC18F45K22 U PIC18F46K22 U

 T=TESTED
 U=UNTESTED

Notes

  1. These devices must be flashed with VPP at 9V. The simplest means to do this on a K8048 is to either connect a 9V1 zener diode or 6K8 resistor between pins 4 and 8 on the 8-pin PIC socket. See Appendix C.
Table of contents

Devices that may be supported later

16f57

In circuit serial programming.

12-bit word / 8-bit data architecture

  N/A

14-bit word / 8-bit data architecture

  N/A

16-bit word / 8-bit data architecture

  PIC18F14K50 (see notes 1, 2 and 3)
  PIC18F27J53 (see note 5)

24-bit word / 16-bit data architecture

  dsPIC30F4013 (see note 4)

Notes

  1. Not pin compatible with the K8048.
  2. 9V programming on VPP.
  3. PGD and PGC must be limited to 3V3.
  4. There is no plan to support this device at present.
  5. Incompatible with the K8048.
Table of contents

Installing the application

16f57

A PIC16F57 connected via ICSP.

Download the lastest stable application archive from here or alternatively the latest development archive here, then decompress and extract the application source code from the archive. Once you perform sudo make install, the application will be ready for use. This has been tested on FreeBSD 5 and 6 yet should work on all FreeBSD variants and other BSD derived systems. It has also been test to work in Linux 2.6 but only compiled for 2.4.

Here are some sample sessions obtaining the application and then installing it.

FreeBSD application installation

# cd /usr/ports/devel/gmake
# make
# make install
# cd /usr/ports/devel/gputils
# make
# make install
# cd /usr/ports/cad/geda-utils
# make
# make install
# cd /root
# fetch "http://dev.kewl.org/k8048/k8048-2.12.tar.gz"
# tar zxf k8048-2.12.tar.gz
# cd k8048
# rehash
# gmake build-all
# gmake install-all

Generic UNIX application installation

$ wget -q http://dev.kewl.org/k8048/k8048-2.12.tar.gz
$ tar zxf k8048-2.12.tar.gz
$ cd k8048
$ gnumake
$ sudo gnumake install

Debian GNU/Linux application installation

$ sudo apt-get install build-essential
$ wget -q http://dev.kewl.org/k8048/k8048-2.12.tar.gz
$ tar zxf k8048-2.12.tar.gz
$ cd k8048
$ make
$ sudo make install

Debian GNU/Linux full installation

$ sudo apt-get install build-essential
$ sudo apt-get install libreadline-dev
$ sudo apt-get install libncurses-dev
$ sudo apt-get install gputils
$ sudo apt-get install geda
$ sudo apt-get install geda-utils
$ wget -q http://dev.kewl.org/k8048/k8048-2.12.tar.gz
$ tar zxf k8048-2.12.tar.gz
$ cd k8048
$ make build-all
$ sudo make install-all

Cygwin for windows installation

$ wget -q http://dev.kewl.org/k8048/k8048-2.12.tar.gz
$ tar zxf k8048-2.12.tar.gz
$ cd k8048
$ make
$ make install
$ cd ~
$ vi .k8048
DEVICE=/dev/ttyS2
SLEEP=0
BITRULES=0x1F
BUSY=50
:wq!

If `make' fails to build correctly there may be a missing dependency in your system such as the readline development headers.

In such a circumstance refer to your distribution manual and perform something similar to apt-get install libreadline4-dev or whatever is required for your distro.

In exceptional circumstances you may need to edit the Makefile, please notify me if you do so.

Table of contents

Configuring the application

16f887

A PIC16F887.

A dot file in your home directory (.k8048) is used to configure the application.

The options are as follows.

# I/O device; tty or RPI
#
#DEVICE=/dev/ttyS0
#DEVICE=/dev/ttyUSB0
DEVICE=RPI

# I/O per half-bit sleep time in us. 1us should be fine for ttyS and 500us for
# ttyUSB.
# When SLEEP is set to zero, sleep time is equal to port input read time which
# is 1us for ttyS.
#
# ttyS
#SLEEP=1
# ttyUSB
#SLEEP=500
# RPI
SLEEP=10

# I/O bit rules. These determine the polarity of the control lines and whether
#                data input requires data output pulled high.
# 0x01 PGD_OUT_FLIP
# 0x02 PGC_OUT_FLIP
# 0x04 VPP_OUT_FLIP
# 0x08 PGD_IN_FLIP
# 0x10 PGD_IN_PULLUP
#
# K8048(tty) = PGD_IN_PULLUP + PGD_OUT_FLIP + PGC_OUT_FLIP + VPP_OUT_FLIP + PGD_IN_FLIP
# K8076(tty) = PGD_IN_PULLUP
# K8048(RPI) = PGD_IN_PULLUP
#
# K8048 ttyS/ttyUSB
#BITRULES=0x1f
# K8076 ttyS/ttyUSB
#BITRULES=0x10
# K8048 RPI (74HC03)
BITRULES=0x10

# I/O busy cursor speed (lower is faster)
# 
BUSY=50

# RPI PINS (README.raspi)
#
# VPP/!MCLR  - DSUB9(3)
#TX=14
# DATA CLOCK - DSUB9(7)
#RTS=15
# DATA OUT   - DSUB9(4)
#DTR=23
# DATA INPUT - DSUB9(8)
#CTS=24

# RPI PINS (http://dev.kewl.org/k8048/Images/K8048-RPI/)
#
# VPP/!MCLR  - DSUB9(3)
TX=14
# DATA CLOCK - DSUB9(7)
RTS=18
# DATA OUT   - DSUB9(4)
DTR=24
# DATA INPUT - DSUB9(8)
CTS=25

# ICSP I/O per half-bit sleep time for `kio'.
FWSLEEP=30

# Debug level (0=NONE, 1=ERROR, 10=INFO)
DEBUG=1

FreeBSD using a K8048 with a serial UART

DEVICE=/dev/cuad0
SLEEP=0
BITRULES=0x1F
BUSY=50

R-PI using a K8048 with a 74HC03

DEVICE=RPI
SLEEP=10
BITRULES=0x10
TX=14
RTS=18
DTR=24
CTS=25

Cygwin for Windows using a K8048 with an Intek21 PCI IO 2S-550 Board

DEVICE=/dev/ttyS2
SLEEP=0
BITRULES=0x1F
BUSY=50
Table of contents

Running the application

16f877A

A PIC16F877A connected via ICSP.

There are multiple ways to run the k8048 application and it's mode of operation is selected by using one of it's symlinked command variations.

k8048 - Show usage of other modes of operation

$ k8048
USAGE: k12 | k14 | k16 | ktest

FILES:
 /home/darron/.k8048
                Configuration.

EXAMPLES:
 k12 SELECT DEVICE OPERATION [ARG]
                12-bit word PIC10F/12F/16F operations.
 k14 [SELECT DEVICE] OPERATION [ARG]
                14-bit word PIC10F/12F/16F operations.
 k16 OPERATION [ARG]
                16-bit word PIC18F operations.
 ktest TEST ARG
                Hardware tests.

k12 - Perform operations on 12-bit word architecture devices

$ k12
USAGE: k12 SELECT DEVICE OPERATION [ARG]
12-bit word PIC10F/12F/16F operations.

Error: Missing arg(s).

FILES:
 /home/darron/.k8048
                Configuration.

EXAMPLES:
 k12 select PIC1XFXXX blank
                Blank device (disable protection and bulk erase).
 k12 select PIC1XFXXX config
                Display device configuration.
 k12 select PIC1XFXXX dump
                Dump device content (intel hex32 format).
 k12 select PIC1XFXXX flash [n]
                Display all or n words of program flash content.
 k12 select PIC1XFXXX id
                Display device identification.
 k12 select PIC1XFXXX osccal
                Display oscillator calibration.
 k12 select PIC1XFXXX osccal 0x0c1a
                Restore oscillator calibration as 0x0c1a.
 k12 select PIC1XFXXX program file.hex
                Program file.hex in flash (intel hex32 format).
 k12 select PIC1XFXXX verify file.hex
                Verify file.hex in flash (intel hex32 format).

k14 - Perform operations on 14-bit word architecture devices

XINO

A PIC16F88 in a Xino Basic for PIC.

$ k14
USAGE: k14 [SELECT DEVICE] OPERATION [ARG]
14-bit word PIC10F/12F/16F operations.

Error: Missing arg(s).

FILES:
 /home/darron/.k8048
                Configuration.

EXAMPLES:
 k14 select PIC16F84 OPERATION [ARG]
                Select device PIC16F84.
 k14 blank
                Blank device (disable protection and bulk erase).
 k14 config
                Display device configuration.
 k14 config 0x3000
                Restore band-gap configuration as 0x3000.
 k14 dump
                Dump device content (intel hex32 format).
 k14 eeprom
                Display data EEPROM content.
 k14 flash [n]
                Display all or n words of program flash content.
 k14 id
                Display device identification.
 k14 osccal
                Display oscillator calibration.
 k14 osccal 0x343c
                Restore oscillator calibration as 0x343c.
 k14 program file.hex
                Program file.hex in flash (intel hex32 format).
 k14 verify file.hex
                Verify file.hex in flash (intel hex32 format).

k16 - Perform operations on 16-bit word architecture devices

$ k16
USAGE: k16 OPERATION [ARG]
16-bit word PIC18F operations.

Error: Missing arg(s).

FILES:
 /home/darron/.k8048
                Configuration.

EXAMPLES:
 k16 blank
                Blank device (disable protection and bulk erase).
 k16 config
                Display device configuration.
 k16 dump
                Dump device content (intel hex32 format).
 k16 eeprom
                Display data EEPROM content.
 k16 flash [n]
                Display all or n words of program flash content.
 k16 id
                Display device identification.
 k16 program file.hex
                Program file.hex in flash (intel hex32 format).
 k16 verify file.hex
                Verify file.hex in flash (intel hex32 format).

ktest - Perform various hardware and communication tests

ktest 6 LM35

A PIC16F88 with an LM35 attached.

$ ktest
USAGE: ktest TEST ARG
Hardware tests.

Error: Missing args.

FILES:
 /home/darron/.k8048
                Configuration.

EXAMPLES:
 ktest VPP|PGC|PGD 5
                VPP, PGC or PGD LOW->HIGH->LOW test with 5 seconds high time.
 ktest 0 10
                R-PI GPIO test with 10 seconds mark time.
 ktest 1 10
                D-SUB-9 test with 10 seconds per step.
 ktest 2 10
                ICSP test with 10 seconds per step.
 ktest 3 0
                D-SUB-9 RTS 7 (PGC) DTR 4 (PGD) test with no mark time.
 ktest 3 1
                D-SUB-9 RTS 7 (PGC) DTR 4 (PGD) test with SLEEP mark time.
 ktest 3 100
                D-SUB-9 RTS 7 (PGC) DTR 4 (PGD) test with 100 microseconds mark time.
 ktest 4 100
                16F627 debug test with 100 microseconds clock mark time.
 ktest 5 100
                ICSPIO demo test with 100 microseconds clock mark time.
Table of contents

Using the application

16f54

A PIC16F54.

To demonstrate it's usage we may utilise some assembly code supplied in the asm directory. An example assembly file for the PIC16F627 sends the text "hello, world" over the ICSP lines to the host PC within an infinite loop.

The ktest command has a function to decode the text as sent above and dump it to the console, below is an example of assembling the assembly code file, writing it to the PIC16F627 chip and dumping out the text sent by the chip.

Build test and example assembly files

$ cd Src
$ make build-asm

Program PIC16F627 with debug assembly

$ k14 program asm/pic16f627/debug.hex 
Total: 100
$ k14 verify asm/pic16f627/debug.hex
Total: 100 Pass: 100 Fail: 0

It is important to remember that the K8048 board must be set to the PROG. mode when writing to the chip and set to the RUN mode to execute code.

PIC16F627 debug assembly test mode

$ ktest 4 100

TEST MODE 4 [16F627 debug.asm] CTRL-C TO STOP

io_test4: read byte: 02 .
io_test4: read byte: 48 H
io_test4: read byte: 65 e
io_test4: read byte: 6C l
io_test4: read byte: 6C l
io_test4: read byte: 6F o
io_test4: read byte: 2C ,
io_test4: read byte: 20  
io_test4: read byte: 77 w
io_test4: read byte: 6F o
io_test4: read byte: 72 r
io_test4: read byte: 6C l
io_test4: read byte: 64 d
io_test4: read byte: 0A .
io_test4: read byte: 03 .
io_test4: read line: Hello, world
io_test4: read byte: 02 .
^C
TEST DONE

Two Velleman supplied demos can also be found in the asm/velleman directory which may be used to test a PIC16F627 as per the Velleman kit documentation.

Below are other examples of using the other commands available in k8048.

Display device identity

$ k14 id
[0000] [PROGRAM]  0400 WORDS
[2000] [USERID0]  3FFF .
[2001] [USERID1]  3FFF .
[2002] [USERID2]  3FFF .
[2003] [USERID3]  3FFF .
[2004] [RESERVED] 3FFF .
[2005] [RESERVED] 3FFF .
[2006] [DEVICEID] 07A0 DEV:7A0 (3D) REV:0 PIC16F627
[2007] [CONFIG]   3F61
[2100] [DATA]     0080 BYTES

Display device configuration

$ k14 config
[2007] [CONFIG]   3F61

Code protection for 2K program memory:
        [CP] Program memory code protection off

Code protection for 1K program memory:
        [CP] Program memory code protection off

[CPD] Data memory code protection off

[LVP] Low voltage programming disabled

[BODEN] Brown-out detect reset enabled

[MCLRE] MCLR enabled

[PWRTE] Power-up timer enabled

[WDT] Watchdog timer disabled

Oscillator selection:
        [XT] 001

Display EEPROM

$ k14 eeprom
[2100] 48 65 6C 6C 6F 2C 20 77 6F 72 6C 64 0A 00 FF FF Hello, world....

Display flash

$ k14 flash
[0000] 2846 3FFF 3FFF 3FFF 0009 3020 00A0 01A1 
[0008] 0BA1 2808 0BA0 2807 0008 3000 00A2 01A3 
[0010] 1F06 0008 0BA3 2810 0BA2 280F 0008 3000 
[0018] 00A2 01A3 1B06 0008 0BA3 281A 0BA2 2819 
[0020] 0008 00A4 1406 200D 1786 2017 1386 3008 
[0028] 00A5 200D 0103 0CA4 1803 3080 0086 2017 
[0030] 0BA5 2829 1006 0008 1683 009B 1283 3002 
[0038] 2021 1683 141C 081A 0A9B 1283 3800 1903 
[0040] 2843 2021 2839 3003 2021 0008 1283 3007 
[0048] 009F 1683 118E 018B 3080 0081 3040 0086 
[0050] 30FF 0085 1283 0186 3000 2034 2005 2854 

Dump device

$ k14 dump
:020000040000FA
:100000004628FF3FFF3FFF3F09002030A000A1012D
:10001000A10B0828A00B072808000030A200A301AC
:10002000061F0800A30B1028A20B0F2808000030A1
:10003000A200A301061B0800A30B1A28A20B192873
:100040000800A40006140D20861717208613083018
:10005000A5000D200301A40C031880308600172092
:10006000A50B29280610080083169B008312023076
:10007000212083161C141A089B0A831200380319C6
:10008000432821203928033021200800831207301B
:100090009F0083168E118B018030810040308600D6
:1000A000FF3085008312860100303420052054285B
:10420000480065006C006C006F002C0020007700F7
:104210006F0072006C0064000A000000FF00FF00E5
:02400E00613F10
:00000001FF

I hope you enjoy using this application, good luck.

Table of contents

Appendix A: Cygwin for Windows setup

Installation
------------
Run setup.exe: http://cygwin.com/install.html

Root Directory: C:\Cygwin
Local Package Directory: C:\Cygwin\SYSINSTALL

Select Packages
---------------
Devel: gcc
Devel: make
Web: wget
Editors: vim

Install and accept solution to package dependencies.
Copy setup.exe to C:\Cygwin\SYSINSTALL for later use.

You may now run the Cygwin Terminal.

Intek21 PCI IO 2S-550 Board
---------------------------
VENDOR: 0x14DB Avlab Technology Inc.
DEVICE: 0x2130 2 Port PCI Serial Card
Driver: http://www.avlab.com.tw/drivers/03-001e.rar
Manual: http://www.avlab.com.tw/manuals/5303_0003_004.pdf

Table of contents

Appendix B: Raspberry Pi interface

CASE

Interface connected to the R-PI in a playing card 'Ace' case.

Circuit schematic

I.C. 74HC03 QUAD TWO INPUT NAND GATE O/D

The three outputs drive three of four inverting NAND O/D gates.
The single input drives the fourth remaining gate.

 +5V------------+----------------------------------------Vcc
                |
               === 100n
                |
 GND------------+------------------------------GND D-SUB-9 5

                |--\           +----2K2---Vcc
 GPIO14(X)---+--|   \          |
             |  |    |O--------+-----------TX/MCLR D-SUB-9 3
             +--|   /
                |--/

                |--\           +----2K2---Vcc
 GPIO18------+--|   \          |
             |  |    |O--------+---------RTS/CLOCK D-SUB-9 7
             +--|   /
                |--/

                |--\           +----2K2---Vcc
 GPIO24------+--|   \          |
             |  |    |O--------+------DTR/DATA_OUT D-SUB-9 4
             +--|   /
                |--/
                          +----1M(+)----GND
                /--|      |
               /   |--+---+----4K7(*)--CTS/DATA_IN D-SUB-9 8
 GPIO24------O|    |  |  _|_
               \   |--+  /_\ 5V1 ZENER(*)
                \--|      |
                         GND

(X) When using either GPIO14 or GPIO15 kernel logging and a serial
    console process must be deactivated on these pins which double
    up as a UART.

    sudo bash
    cp /etc/inittab /etc/inittab.dist
    sed -i 's/T0:23:respawn:/#T0:23:respawn:/g' /etc/inittab

    cp /boot/cmdline.txt /boot/cmdline.txt.dist
    echo "dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 \
    rootfstype=ext4 elevator=deadline rootwait" > /boot/cmdline.txt
    sync
    reboot

(+) To stop stray noise pickup when the K8048 is disconnected.
    This is not required for normal and connected operation.

(*) K8076 or compatible serial device only (untested). These are
    not required for operation with the K8048.
    The I/O BITRULES for the K8076 are the inverse of those for the
    K8048; update the .k8048 profile accordingly.

Stripboard layout

TOP

Top.

BOTTOM

Bottom.

X marks where a track must be cut on the bottom with a stripboard surface cutter.

Components

BOM

The serial header is a standard P.C. motherboard header.

Stripboard is also cut with a hacksaw and stanley knife along the centers (lengthwise) of the IDC headers.

Assembled

BUILT

Wire links are cut from CW1308 telephone cable.

BUILT

The finished article with a corner trimmed to fit the R-PI case.

You may wire a pull-down resistor to IC pin 4/5 to GND to stop stray noise pickup when the K8048 is disconnected. This isn't needed for normal and connected operation.

PULLDOWN

1M pull-down modification.

For the K8076 (untested) you may replace the second from left link with a resistor then connect a zener diode anode to ground and cathode to IC pin 4/5. There is ample room to accomplish this modification along with the pull-up modification above.

In operation

RUN

The R-PI queries the PICMicro to reveal that it's a PIC16F648A.

The serial header above is a longer example than the one first shown and works just as well. The maximum possible length is unknown.

Table of contents

Appendix C: K8048 9V HVP adapter

9V

9V HVP adapter.

A simple high voltage programming adapter for the K8048. Just a 6K8 resistor and an 8-pin turned pin socket is required. The `plug' may be used in either the 8P or 14P socket and will reduce VPP from ~13V to ~9V. A good storage location is the unconnected bottom 8 pins on socket 28P (pins 11 to 18).

Table of contents

Appendix D: README

Further documentation may be found in the source archive or here.

Document About
README.1212-bit word architecture devices
README.1414-bit word architecture devices
README.1616-bit word architecture devices
README.icspioMulti-architecture ICSP communications
README.k8048K8048 I.C. socket cross reference and ICSP pin-out
README.raspiInformation about the R-PI interface
README.serialAbout the K8048 serial interface implementation
README.txtApplication platforms and installation
README.xinoXino Basic for PIC header reference guide

Table of contents

Valid CSS! Valid HTML 4.01!