Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Call Get2byteEEprom ;Get 2 precious bytes.
Call SetupUsart ;Initial USART.
movf eeprom_byte1, w ;--Moving First byte to USART TX--
movwf TXREG
Call WaitTillTXComplete
movf eeprom_byte2, w ;--Moving Second byte to USART TX
movwf TXREG
Call WaitTillTXComplete
;This snippet took 10x longer to type
;than to conceive. Type time ~ 1 minute.
donniedj said:I thought one of the purposes of C for micros was to provide a pool from which simple routines may be sourced. C already has EEprom_Read() and SerialTX(), PutC(), Cputs(), or whatever proprietary function nomenclature dictated by the compiler at that particular build time. Just combine them.
Well anyway this is how the asm will most likely if not look like will do in the end anyway.
Code:Call Get2byteEEprom ;Get 2 precious bytes. Call SetupUsart ;Initial USART. movf eeprom_byte1, w ;--Moving First byte to USART TX-- movwf TXREG Call WaitTillTXComplete movf eeprom_byte2, w ;--Moving Second byte to USART TX movwf TXREG Call WaitTillTXComplete ;This snippet took 10x longer to type ;than to conceive. Type time ~ 1 minute.
#include <pic1687x.h>
// Transmitter test program
void main() {
TRISC = 0x00 ; //portC as output
SPBRG = 129; // Set the baud rate to 2.4k
BRGH = 1; // Set high baud rate
SYNC = 0; // Set asynchronous
SPEN = 1; // Enable serial port pins
TX9 = 0; // Disable 9 bit transmission
TXIE = 0; // Disable tx interrupts
RCIE = 0; // Disable rx interrupts
TXEN = 1; // Enable the transmitter
while(1) {
while(!TXIF) { // Checks if the transmit flag is down
continue;
}
TXREG = 0b01010101;
}
}