PIC Assembler Modules

For Non-Commercial Use Only
 
I would appreciate to be credited within your project, if you use any of the source code below. If you have an interesting project going on, I'll be glad about feedback.

The software below comes with no guarantee or warranty except for my good intentions. Further the use of this code implies that the user has a fundamental understanding of electronics and its risks. I'm not responsible for any harm or damage, caused by inproper use of any of the code below.
Any commercial use of parts or all of this code requires the permission of the author.

 

General

Modules are source code blocks, which can be included in the MAIN PROGRAM by simply adding the command line :
  #include "C:/ (...) /m_bank.asm"
 

Standard Modules

 m_bank.html Bank0, Bank1  m_bank.asm
 m_wait.html Wait Function  m_wait.asm
 m_beep.html  Beeper  m_beep.asm


Dot LCD Modules
 

Dot Matrix LCD Display
2 lines x 40 characters

 m_lcd.html V2.02  7 wires, 4 bit LCD interface
Based on timing constraints, no busy flag check. So if LCD fails, system is still running stable. Higher reliability, because less critical system components.
No portable code for higher clock frequencies.
R/W connection to LCD supported for compatibility to m_lcd_bf.asm, but can be put to GND at LCD side => You'll get one interrupt pin more on the processor side.
 m_lcd.asm
 m_lcdx.html V2.22  Extended m_lcd.asm with the ability to define your own characters (max. 8)
Based on timing constraints, specifications as m_lcd.asm.
 m_lcdx.asm
 m_lcd_bf.html V3.03  Extended m_lcd.asm which reads busy flag of LCD
R/W connection to LCD needed for hand shaking.
Clock independent program code, succesfully tested up to 10 MHz on PIC 16F84 and up to 20 MHz on 16C74A !
Gives the best performance, but system fails, if LCD (-connection) fails, because processor is waiting for ready signal from LCD to send next character. => Deadlock, but should not occur under normal circumstances !
Solution:
Connect an auxilliary 10k resistor from DB7 to GND, so if the LCD is disconnected, the microprocessor will read an inactive busy flag. (That's needed because of the internal weak pull ups of the microprocessor ports. Maybe also needed if you switch them off.)
 m_lcd_bf.asm
 m_lcdxbf.html V3.23  Extended m_lcd_bf.asm with the ability to define your own characters (max. 8)
Reads busy flag of LCD, specifications as m_lcd_bf.asm.
 m_lcdxbf.asm
 m_lcdv08.html 8 bit binary to decimal conversion routine for LCD output.  m_lcdv08.asm 
 m_lcdv16.html 16 bit binary to decimal conversion routine for LCD output.  m_lcdv16.asm
 m_lcdb08.html 8 bit binary LCD output routine for debugging registers and bitstreams.  m_lcdb08.asm
 m_lcdb16.html 16 bit binary LCD output routine for debugging registers and bitstreams.  m_lcdb16.asm


RS232 Modules

For external interrupts, such as the RB0/INT pin or PORTB change interrupt, the latency will be three to four instruction cycles. The exact latency depends when the interrupt occurs. The latency is the same for both one and two cycle instructions.
(=> see Microchip PIC16/17 Microcontroller Databook.)

Module m_rs096.asm was named earlier m_rs232.asm .

For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232 :   RS232-Interface.pdf   (9.7 kB)

 m_rs024.html Completely software handled RS232 Interface for interrupt featured PICs (PIC16C84, PIC16F84,...).
Specifications: 2400 baud, 8 bit, no parity, 1 stopbit   (@ 4 MHz)
 m_rs024.asm
 m_rs048.html As m_rs024.asm
Specifications: 4800 baud, 8 bit, no parity, 1 stopbit   (@ 4 MHz)
 m_rs048.asm
 m_rs096.html As m_rs024.asm
Specifications: 9600 baud, 8 bit, no parity, 1 stopbit   (@ 4 MHz)
 m_rs096.asm
 m_rs192.html As m_rs024.asm
Specifications: 19200 baud, 8 bit, no parity, 1 stopbit   (@ 4 MHz)
 m_rs192.asm
 m_rs7n1.html As m_rs024.asm
Developed for a matrix needle printer with RS232 Interface.
Specifications: 9600 baud, 7 bit, no parity, 1 stopbit   (@ 4 MHz)
 m_rs7n1.asm


For complete programs, refer to "Projects"
 

Notes on Modules

Known Bugs

Hints



If you see only this page in your browser window,
click here
to get the entire site.