# HG changeset patch # User JeanDo # Date 1304990300 -7200 # Node ID 447390289f47b4b4c2ddea9cf190a53d622700b5 # Parent 1adcfb4b4c27c60630e2ca9360c1f6630a6fbabd NEW screen_dump serial command (l) diff -r 1adcfb4b4c27 -r 447390289f47 code_part1/OSTC_code_asm_part1/MAIN.ASM --- a/code_part1/OSTC_code_asm_part1/MAIN.ASM Mon May 09 08:12:12 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/MAIN.ASM Tue May 10 03:18:20 2011 +0200 @@ -88,6 +88,7 @@ #include oled_samsung.asm ; Attached in 80-System 8-Bit Mode #include aa_wordprocessor.asm ; New antialiased word processor and fonts #include color_processor.asm ; Color image drawing. +#include dump_screen.asm ; Copy screen contains to serial interface #include valconv.asm ; outputs to POSTINC2 #include eeprom_rs232.asm ; Internal EEPROM and RS232 Interface #include menu_custom.asm ; Menu "Custom FunctionsI" and "Custom FunctionsII" diff -r 1adcfb4b4c27 -r 447390289f47 code_part1/OSTC_code_asm_part1/definitions.asm --- a/code_part1/OSTC_code_asm_part1/definitions.asm Mon May 09 08:12:12 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/definitions.asm Tue May 10 03:18:20 2011 +0200 @@ -387,8 +387,8 @@ #DEFINE win_flip_screen win_flags,0 ; 180° rotation of the OLED screen. ; Flags -#DEFINE tts_extra_time flag1,0 ; unused -#DEFINE FLAG_2 flag1,1 ; unused +#DEFINE tts_extra_time flag1,0 ; Showing "Future TTS" customview +#DEFINE uart_dump_screen flag1,1 ; Screen copy to USB. #DEFINE pre_zero_flag flag1,2 ; leading zeros #DEFINE neg_flag flag1,3 ; e.g. Sub_16 (sub_c = sub_a - sub_b) #DEFINE FLAG_3 flag1,4 ; unused diff -r 1adcfb4b4c27 -r 447390289f47 code_part1/OSTC_code_asm_part1/dump_screen.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/code_part1/OSTC_code_asm_part1/dump_screen.asm Tue May 10 03:18:20 2011 +0200 @@ -0,0 +1,117 @@ +;============================================================================= +; +; File dump_screen.asm +; +; Dump screen contains to the serial interface. +; +; This program is free software: you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation, either version 3 of the License, or +; (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program. If not, see . +; +; Copyright (c) 2011, JD Gascuel. +;============================================================================= +; HISTORY +; 2011-05-08 : [jDG] Creation. +; +; BUGS : +; * ... +;============================================================================= + +; Manage interface to the OSTC platform: +dump_screen: + bcf uart_dump_screen ; clear flag! + + movlw 'l' + movwf TXREG ; Send command echo. + bsf no_sensor_int ; No Sensor Interrupt + bcf PIE1,RCIE ; no interrupt for UART + bcf PIR1,RCIF ; clear flag + bsf LED_blue ; LEDusb ON + call rs232_wait_tx ; wait for UART + + call dump_screen_0 + + bcf no_sensor_int ; Restore Sensor Interrupt + bcf LED_blue ; Clear led + bcf LED_red ; Clear led + bsf PIE1,RCIE ; Interrupt for RS232 + return + +;============================================================================= +; Dump screen contains to the UART + +dump_screen_0: + + ;---- Send OLED box command for the full screen window ------------------- + mullw 0 ; PRODH:L <- 0 + + AA_CMD_WRITE 0x35 ; VerticalStartAddress HIGH:LOW + AA_DATA_WRITE_PROD ; 00:00 + + AA_CMD_WRITE 0x36 ; VerticalEndAddress HIGH:LOW + AA_DATA_WRITE 0x01 + AA_DATA_WRITE 0x3F + + AA_CMD_WRITE 0x37 ; HorizontalAddress START:END + AA_DATA_WRITE 0x00 + AA_DATA_WRITE 0xEF + + AA_CMD_WRITE 0x20 ; Start Address Horizontal (.0 - .239) + AA_DATA_WRITE_PROD ; 00:00 + + AA_CMD_WRITE 0x21 ; Start Address Vertical (.0 - .319) + AA_DATA_WRITE_PROD ; 00:00 + + AA_CMD_WRITE 0x22 ; Start reading. + rcall PLED_DataRead ; Dummy pixel to skip. + rcall PLED_DataRead ; Dummy pixel to skip. + + movlw .160 ; 160x2 columns + movwf PRODH +dump_screen_1: + btg LED_red ; LEDactivity toggle + + movlw .240 ; 240 lines + movwf PRODL + +dump_screen_2: + setf TRISD ; PortD as input. + + rcall PLED_DataRead ; read first pixel-low byte + movwf TXREG ; send + call rs232_wait_tx ; wait for UART + + rcall PLED_DataRead ; read first pixel-high byte + movwf TXREG ; send + call rs232_wait_tx ; wait for UART + + rcall PLED_DataRead ; read second pixel-low byte + movwf TXREG ; send + call rs232_wait_tx ; wait for UART + + rcall PLED_DataRead ; read second pixel-high byte + movwf TXREG ; send + call rs232_wait_tx ; wait for UART + + clrf TRISD ; Back to normal (PortD as output) + + decfsz PRODL,F + bra dump_screen_2 + + AA_CMD_WRITE 0x22 ; Sync high/low byte, again. + + decfsz PRODH,F + bra dump_screen_1 + + AA_CMD_WRITE 0x00 ; NOP, to stop Address Update Counter + return + diff -r 1adcfb4b4c27 -r 447390289f47 code_part1/OSTC_code_asm_part1/isr.asm --- a/code_part1/OSTC_code_asm_part1/isr.asm Mon May 09 08:12:12 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/isr.asm Tue May 10 03:18:20 2011 +0200 @@ -56,6 +56,8 @@ bsf uart_send_int_eeprom2 ; set flag dcfsnz uart1_temp,F ; "k" bsf uart_store_tissue_data ; set flag + dcfsnz uart1_temp,F ; "l" + bsf uart_dump_screen ; set flag movlw 0xC1 cpfseq RCREG ; 115200Baud Bootloader request? diff -r 1adcfb4b4c27 -r 447390289f47 code_part1/OSTC_code_asm_part1/oled_samsung.asm --- a/code_part1/OSTC_code_asm_part1/oled_samsung.asm Mon May 09 08:12:12 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/oled_samsung.asm Tue May 10 03:18:20 2011 +0200 @@ -184,6 +184,15 @@ ; bsf oled_rw endm ; +; Input : data as macro parameter. +; Output : NONE +; Trash : WREG +; +AA_DATA_WRITE macro data + movlw data + rcall PLED_DataWrite + endm +; ; Input : PRODH:L as 16bits data. ; Output : NONE ; Trash : NONE @@ -517,6 +526,24 @@ return ; ----------------------------- +; PLED Read data into WREG +; ----------------------------- +; NOTE: you should "setf TRISD" before calling this function, +; to make PortD an input port... +PLED_DataRead: + bsf oled_rs ; Data register. + nop ; Enable delay to read data... + bcf oled_e_nwr ; Read enable. + nop + nop + nop + nop + nop + movf PORTD,W ; Read byte. + bsf oled_e_nwr ; release bus. + return + +; ----------------------------- ; PLED boot ; ----------------------------- PLED_boot: diff -r 1adcfb4b4c27 -r 447390289f47 code_part1/OSTC_code_asm_part1/surfmode.asm --- a/code_part1/OSTC_code_asm_part1/surfmode.asm Mon May 09 08:12:12 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/surfmode.asm Tue May 10 03:18:20 2011 +0200 @@ -199,6 +199,8 @@ goto uart_115k_bootloader ; Yes! btfsc uart_reset_battery_stats ; Reset Battery stats? goto reset_battery_stats ; Yes! + btfsc uart_dump_screen ; Dumps screen contains ? + goto dump_screen ; Yes! bra surfloop_loop ; loop surfacemode