An Implementation of Base64 Encoder/Decoder using PIC16F84
Base64 or Radix-64 encoding or ASCII armour or whatever you name it, is a process of transforming arbirtary binary input into printable character. Theoretically speaking, the 3 bytes ( 3 x 8-bit) of input is treated as a block that will be divided into 4 6-bit data. Each of 6-bit data then translated into printable character. The mapping is shown below:

However, this post will demonsrate you how to implement Base64 on hardware, especially on PIC16F84 microcontroller.
This implementation comes in two versions. First version is intended for size optimized application and second version is intended for speed optimized application. Each of version contain its own benefit and drawback. You may choose the one which is match to your purpose.
BENCHMARK
Below are two screenshot of Base64 simulation on MPLAB v8.0. The first one is belong to plain text that is going to be encoded. The second one is belong to decoded message. Encoded message is always approximately 33% longer than its original.
Original Message

Encoded Message

Test Vector:
Original Message : edi
Encoded Message : ZWRp
Speed Benchmark:
- Speed Oriented
-
encoding : 18 cycles / character
-
decoding : 21 cycles / character
- Size Oriented
-
encoding : 26 cycles / character
-
decoding : 1069 cycles / character
RELATED STUFF
Download:
Source Code v1.0 (Size Optimized)
Source Code v2.0 (Speed Optimized)
Source Code v2.1 (Speed Optimized)
PIC16F84 Datasheet
Mid-Range Reference Manual
MPLAB v8.0
Reference:
Base64
Link:
Base64
Base64 encoder decoder
PIC16F84
PIC16F84 Programmer
PIC16F84 Development Board

