how is the best way to get help to convert it to all asm.
int n_bits;
int n_bytes;
int counter;
int recv_reg;
int send_reg;
int nEmpty;
int status_byte;
int send_command;
int general_flags;
int nB8Count;
int nB8;
int nA8Count;
int nA8;
int status_response;
int nCmdCount;
int special_word;
int photo_flag;
void main()
{
// Initialization
//
n_bits = 0;
counter = 0;
recv_reg = 1;
send_reg = 0;
nEmpty = 0;
status_byte = 1;
general_flags = 0;
nB8 = 4;
nB8Count = 0;
nA8 = 3;
nA8Count = 0;
status_response = 1;
special_word = 0x0f;
nCmdCount = 10;
send_command = 0;
photo_flag =0;
******************************************************************
//
// LANC controller
//
//**********************************************************************
//
// Control a Sony DSC-V1 still camera with a 16f876A PIC
//
// Original code: Alberto Caballero Tante
//
//**********************************************************************
//
// This is a beta version of a Sony LANC controller. LANC output
// is on bit 3 of PIC Port C. Connect the camera using a pullup
// resistor.
//
//
//**********************************************************************
//
// 21/10/2005: Beta version
//
//**********************************************************************
//
// Please any commets: [email]translib@hotmail.com[/email] (subject "LANC controller").
//
//**********************************************************************
#include "F:\Alberto\Aplicaciones\CCS Compiler\PIC projects\test_lanc\serie01.h"
int n_bits;
int n_bytes;
int counter;
int recv_reg;
int send_reg;
int nEmpty;
int status_byte;
int send_command;
int general_flags;
int nB8Count;
int nB8;
int nA8Count;
int nA8;
int status_response;
int nCmdCount;
int special_word;
int photo_flag;
#define PORTA 0x05
#define PORTB 0x06
#define PORTC 0x07
#define TRISA 0x85
#define TRISB 0x86
#define TRISC 0x87
#define same 0x01
#define no_same 0x00
#define lanc 0x03
#define STATUS 0x03
#define RP0 0x05
#define RP1 0x06
#define msb 0x07
#define lsb 0x00
#define PC 0x02
#define Z_BIT 0x02
#define command_tx 0x00
#define TrisLanc 0x01
#define Tris 0x11
#define EMPTY_COUNT 0x1D
#define BitStatus0 0x00
#define BitStatus1 0x02
#define BitStatus2 0x03
#define BitStatus3 0x04
#define BitStatus4 0x05
#define Bit0ECommand 0x01
#define Bit0 0x00
#define Bit1 0x01
#define Bit2 0x02
// Commands
#define COMMAND_0E 0x0E
#define PRE_CMD_1E 0x1E
#define POWER_OFF 0x5E
#define PHOTO 0x5A
#define WORD1 0x43
#define WORD2 0x53
#define SEND_CMD 0x01
#define OUTPUT_PINS 0x00
#define INPUT_PINS 0xFF
void main()
{
// Initialization
//
n_bits = 0;
counter = 0;
recv_reg = 1;
send_reg = 0;
nEmpty = 0;
status_byte = 1;
general_flags = 0;
nB8 = 4;
nB8Count = 0;
nA8 = 3;
nA8Count = 0;
status_response = 1;
special_word = 0x0f;
nCmdCount = 10;
send_command = 0;
photo_flag =0;
#asm
bcf STATUS, RP0
bcf STATUS, RP1
clrf n_bytes
sync_up: clrf counter
sync_loop: btfss PORTC, lanc
goto sync_up
nop
incfsz counter, same
goto sync_loop
synced: clrf n_bytes
wait_strt: btfsc PORTC, lanc
goto wait_strt
start_bit: movlw 15
movwf counter
l1: decfsz counter, same
goto l1
btfsc PORTC, lanc
goto error
movlw 8
movwf n_bits
wait_bits: movlw 15
movwf counter
l2: decfsz counter, same
goto l2
send_bits: btfss general_flags, command_tx
goto wait_half
btfss send_reg, lsb
goto send_0
send_1: bcf PORTC, lanc
bsf STATUS, RP0
movlw OUTPUT_PINS
movwf TRISC
//bcf STATUS, RP0
nop
nop
goto bit_sent
send_0: bsf PORTC, lanc
bsf STATUS, RP0
movlw INPUT_PINS
movwf TRISC
bcf STATUS, RP0
nop
nop
bit_sent: rrf send_reg, same
movlw 10
goto jump_half
wait_half: movlw 15
jump_half:
movwf counter
l3: decfsz counter, same
goto l3
read_bits:
rrf recv_reg, same
bcf recv_reg, msb
btfss PORTC, lanc
bsf recv_reg, msb
nop
nop
decfsz n_bits, same
goto wait_bits
wait_stop: movlw 14
movwf counter
l4: decfsz counter, same
goto l4
send_stop: btfss general_flags, command_tx
goto wait_half_stop
bsf PORTC, lanc
bsf STATUS, RP0
movlw INPUT_PINS
movwf TRISC
bcf STATUS, RP0
bcf general_flags, command_tx
movlw 11
goto jump_half_stop
wait_half_stop:
movlw 14
jump_half_stop:
movwf counter
l5: decfsz counter, same
goto l5
read_stop: btfss PORTC, lanc
goto error
count:
incf n_bytes, same
decf n_bytes, w
andlw 07
addwf PC, same
goto check_0
goto check_1
goto check_2
goto check_3
goto check_4
goto check_5
goto check_6
goto check_7
//////////////////////////////////////////
// Byte 0
//////////////////////////////////////////
check_0:
btfss send_command, 0
goto wait_strt
send_command:
movlw PHOTO
movwf send_reg
movlw SEND_CMD
movwf general_flags
goto wait_strt
//////////////////////////////////////////
// Byte 1
//////////////////////////////////////////
check_1:
btfss status_byte, BitStatus2
goto wait_strt
send_43: // Send special values
movf special_word, no_same
movwf send_reg
movlw SEND_CMD
movwf general_flags
goto wait_strt
//////////////////////////////////////////
// Byte 2
//////////////////////////////////////////
check_2:
btfsc status_byte, BitStatus0
goto status_0
btfsc status_byte, BitStatus1
goto status_1
btfsc status_byte, BitStatus3
goto status_2
goto wait_strt
status_0:
movlw 0
addwf recv_reg, no_same
btfsc STATUS, Z_BIT
incf nEmpty, same
goto wait_strt
status_1:
movlw 0x47
subwf recv_reg, no_same
btfsc STATUS, Z_BIT
incf nB8Count
goto wait_strt
status_2:
movlw 0x57
subwf recv_reg, no_same
btfsc STATUS, Z_BIT
incf nA8Count
goto wait_strt
//////////////////////////////////////////
// Byte 3
//////////////////////////////////////////
check_3:
goto wait_strt
check_4:
goto wait_strt
check_5:
goto wait_strt
check_6:
goto wait_strt
check_7:
btfss status_byte, Bit0ECommand
goto begin_spare
// Send 0x0E command
movlw COMMAND_0E
movwf send_reg
movlw SEND_CMD
movwf general_flags
// Time to check the state
begin_spare:
btfsc status_byte, BitStatus0
goto spare_status_0
btfsc status_byte, BitStatus1
goto spare_status_1
btfsc status_byte, BitStatus2
goto spare_status_2
btfsc status_byte, BitStatus3
goto spare_status_3
goto end_spare
spare_status_0:
movlw EMPTY_COUNT
subwf nEmpty, no_same
btfss STATUS, Z_BIT
goto end_spare
// Change status
movlw 0x06
movwf status_byte
// Send 0x0E command in next frame
movlw COMMAND_0E
movwf send_reg
movlw SEND_CMD
movwf general_flags
goto end_spare
spare_status_1:
movf nB8, no_same
subwf nB8Count, no_same
btfss STATUS, Z_BIT
goto end_spare
// Change status
movlw 0x0A
movwf status_byte
movlw 3
movwf nB8
clrf nB8Count
//goto end_spare
spare_status_2: // Send AC, AC
btfsc status_response, Bit0
goto send_BC
btfsc status_response, Bit1
goto send_AC1
btfsc status_response, Bit2
goto send_AC2
goto error
send_BC:
// Change state
movlw 0x02
movwf status_response
// Prepare to send
movlw WORD1
movwf special_word
goto end_spare
send_AC1:
// Change state
movlw 0x04
movwf status_response
// Prepare to send
movlw WORD2
movwf special_word
goto end_spare
send_AC2:
// Change state
movlw 0x01
movwf status_response
movlw 0x12
movwf status_byte
// Prepare to send
movlw WORD2
movwf special_word
goto end_spare
spare_status_3: // Read A8's
movf nA8, no_same
subwf nA8Count, no_same
btfss STATUS, Z_BIT
goto end_spare
// Change status
movlw 0x06
movwf status_byte
movlw 3
movwf nA8
clrf nA8Count
movlw 0xff
movwf photo_flag;
end_spare:
btfss photo_flag, 0x00
goto sync_up
//movlw 0
//movwf photo_flag;
bcf status_byte, Bit0ECommand
//bsf status_byte, BitStatus4
movlw 0xFF
movwf send_command
pre_cmd:
// Send 0x1E pre-command byte
movlw PRE_CMD_1E
movwf send_reg
movlw SEND_CMD
movwf general_flags
check_count:
decfsz nCmdCount, same
goto sync_up
end_cmd:
// No more command. Restore state
movlw 10
movwf nCmdCount
//bcf status_byte, BitStatus4
movlw 0
movwf send_command
bsf status_byte, Bit0ECommand
movlw COMMAND_0E
movwf send_reg
movlw SEND_CMD
movwf general_flags
movlw 0
movwf photo_flag
goto sync_up
luz:
#endasm
output_b(0xff);
#asm
goto fin
error:
#endasm
while(1)
{
output_b(0xff);
delay_ms(500);
output_b(0x00);
delay_ms(500);
}
#asm
error2:
#endasm
while(1)
{
output_b(0xff);
delay_ms(250);
output_b(0x00);
delay_ms(250);
}
#asm
fin:
#endasm
cblock 0x20 (or whatever address free RAM starts at in that PIC)
n_bits
n_bytes
counter
recv_reg
send_reg
etc.
cblock 0x20
n_bits
n_bitsH
n_bytes
n_bytesH
etc.
endc
If some one could explain in very simple terms what this does
#include "p16F676.inc"
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _XT_OSC & _MCLRE_OFF & _CPD_OFF
errorlevel -302
cblock 0x20
n_bits;
n_bytes;
counter;
recv_reg;
send_reg;
nEmpty;
status_byte;
send_command;
general_flags;
nB8Count;
nB8;
nA8Count;
nA8;
status_response;
nCmdCount;
special_word;
photo_flag;
d1
d2
d3
endc
#define LED PORTA
#define LANC PORTC
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#define same 0x01 ;
#define no_same 0x00 ;
;#define STATUS 0x03 ;
;#define RP0 0x05 ;will not compile with these???
;#define RP1 0x06 ;
#define msb 0x07 ;
#define lsb 0x00 ;
#define PC 0x02 ; not sure if these have to be here ???
#define Z_BIT 0x02 ;
#define command_tx 0x00 ;
#define TrisLanc 0x01 ;
#define Tris 0x11 ;??????????????
#define EMPTY_COUNT 0x1D ;
#define BitStatus0 0x00 ;
#define BitStatus1 0x02 ;
#define BitStatus2 0x03 ;
#define BitStatus3 0x04 ;
#define BitStatus4 0x05 ;
#define Bit0ECommand 0x01 ;
#define Bit0 0x00 ;
#define Bit1 0x01 ;
#define Bit2 0x02 ;
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;// Commands
#define COMMAND_0E 0x0E
#define PRE_CMD_1E 0x1E
#define POWER_OFF 0x5E
#define PHOTO 0x5A
#define WORD1 0x43
#define WORD2 0x53
#define SEND_CMD 0x01
#define OUTPUT_PINS 0x00
#define INPUT_PINS 0xFE ;LEAVES PORTC.0 OUTPUT FOR LED
;//////////////////////////////TURN COMPARATOR OFF//////////////////////////////////////////
bcf STATUS,RP0 ;BANK 0
bcf STATUS,RP1 ; register page 0
movlw 0X07 ;SET UP W TO TURN COMPARATOR OFF
movwf CMCON
;////////////////////////////SET UP I/O////////////////////////////////////////////////////
bSf STATUS,RP0 ; BANK 1
movlw b'00000000' ;CONFIG I/O
movwf TRISA ;
movlw b'00000000' ;CONFIG I/O LANC INPUT @ POWER!!!!!!!!!!!!!!!!!!!
movwf TRISC ;TO ALL OUTPUTS
;/////////////////////////////SET UP A/D/////////////////////////////////////////////////
MOVLW B'00000000' ; A/D OFF
MOVWF ANSEL ;IS IN BANK 1
;//////////////////////////////////////SET OR CLEAR BITS @START UP///////////////////////
;???????????????????????????????????????????????
;???????????????????????????????????????????????
;
;void main() ?? IS THIS NEEDED??
;{
;// Initialization
;//
CLRF PORTA
CLRF PORTC
clrf n_bits ;= 0;
clrf counter ;= 0;
clrf send_reg ;= 0;
clrf nEmpty ;= 0;
clrf general_flags ;= 0;
clrf nB8Count ;= 0;
clrf nA8Count ;= 0;
clrf send_command ;= 0;
clrf photo_flag ;= 0;
;????????????????????????????????????????
BSF recv_reg,0 ;= 1;
BSF status_byte,0 ;= 1;
BSF status_response,0 ;= 1;
;???????????????????????????????????????
;?????????? I MAY NOT EVEN BE CLOSE ON THIS???????
;??????;special_word = 0x0f;??????
movlw 0X0F
movwf special_word
;???????;nCmdCount = 10;????????
movlw 10
movwf nCmdCount
;????????????;nA8 = 3;??????????????????
movlw 3
movwf nA8
;?????????????; nB8 = 4;??????????????
movlw 4
movwf nB8
;??????????????????????????????????????????????????
;??????????????????????????????????????????????????
cblock 0x20
n_bits:2
n_bytes:2
counter:2
recv_reg:2
send_reg:2
.
.
endc
No I do not with out it I did not think I could compile in "C"You really need the file serie01.h used in the program - do you have it?
;#define RP0 0x05 ;will not compile with these???
;#define RP1 0x06 ;
#define PC 0x02 ; not sure if these have to be here ???
;?????????????????????????????????????????????????????????????????
;;;;;;;;"c";;;;;;;;;;;;;special_word = 0x0f;
movlw 0x0f ;d15
movwf special_word
;;;;;;;;"c";;;;;;;;;;;;;;nCmdCount= 10;
movlw 10
movwf nCmdCount ;not sure if these 4 are right
;;;;;;;;;;"c";;;;;;;;;;;nA8 = 3;
movlw 3
movwf nA8
;;;;;;;;;;"c";;;;;;;;;;;;;;;;nB8 = 4;
movlw 4
movwf nB8
;??????????????????????????????????????????????????????????????????????
;??????????????????????????????????????????????????????????????????????
;?????????????????????????????????????????????????????????????????
btfsc LANC ;btfsc
goto PROBLEM_2 ;error turn on red LED skip if lanc is clrf
;???????????????????????????????????????????????????????????????????????
;07/25/10/9:00 pm
#include "p16F676.inc"
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _XT_OSC & _MCLRE_OFF & _CPD_OFF
errorlevel -302
cblock 0x20 ;20H-5FH ARE GENERAL PURPOSE REGISTERS
n_bits:2;
n_bytes:2;
counter:2;
recv_reg:2;
send_reg:2;
nEmpty:2;
status_byte:2;
send_command:2;
general_flags:2;
nB8Count:2;
nB8:2;
nA8Count:2;
nA8:2;
status_response:2;
nCmdCount:2;
special_word:2;
photo_flag:2;
endc
#define RED PORTC,0 ;TROUBLE LED
#define LANC PORTC,4 ;READ,WRITE TO CAM
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;Removed what was predefined in the inclued file
#define same 0x01 ;
#define no_same 0x00 ;
#define msb 0x07 ;
#define lsb 0x00 ;
#define PC 0x02 ;
#define Z_BIT 0x02 ;
#define command_tx 0x00 ;
#define TrisLanc 0x01 ;
#define Tris 0x11 ;
#define EMPTY_COUNT 0x1D ;
#define BitStatus0 0x00 ;
#define BitStatus1 0x02 ;
#define BitStatus2 0x03 ;
#define BitStatus3 0x04 ;
#define BitStatus4 0x05 ;
#define Bit0ECommand 0x01 ;
#define Bit0 0x00 ;
#define Bit1 0x01 ;
#define Bit2 0x02 ;
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Commands
#define COMMAND_0E 0x0E
#define PRE_CMD_1E 0x1E
#define POWER_OFF 0x5E
#define PHOTO 0x5A
#define WORD1 0x43
#define WORD2 0x53
#define SEND_CMD 0x01
#define OUTPUT_PINS 0x00
#define INPUT_PINS 0xFE
org 0
nop
;//////////////////////////////TURN COMPARATOR OFF//////////////////////////////////////////
;bcf STATUS,RP0 ;BANK 0
banksel CMCON ; bcf STATUS,RP1 ; register page 0
movlw 0X07 ;SET UP W TO TURN COMPARATOR OFF
movwf CMCON
;////////////////////////////SET UP I/O////////////////////////////////////////////////////
banksel CMCON ;bSf STATUS,RP0 ; BANK 1
movlw b'11111111' ;CONFIG I/O
movwf TRISA ;2,3,4 INPUTS
movlw b'00010000' ;CONFIG I/O LANC INPUT @ POWER!!!!!!!!!!!!!!!!!!!
movwf TRISC ;TO ALL OUTPUTS
;/////////////////////////////SET UP A/D/////////////////////////////////////////////////
MOVLW B'00000000' ; TURN A/D OFF
MOVWF ANSEL ;IS IN BANK 1
;//////////////////////////////////////SET OR CLEAR BITS @START UP///////////////////////
bcf RED ;problem LED
clrf TRISA
clrf n_bits ;= 0;"c"
clrf counter ;= 0;"c"
clrf send_reg ;= 0;"c"
clrf nEmpty ;= 0;"c"
clrf general_flags ;= 0;"c"
clrf send_command ;= 0;"c"
clrf nB8Count ;= 0;"c"
clrf nA8Count ;= 0;"c"
clrf photo_flag ;= 0;"c"
bsf status_response,0 ;= 1;"c"
bsf recv_reg,0 ;= 1;"c"
bsf status_byte,0 ;= 1;"c"
;??????????????????????????????????????????????????????????????????
;;;;;;;;"c";;;;;;;;;;;;;special_word = 0x0f;
movlw 0x0f ;d15
movwf special_word
;;;;;;;;"c";;;;;;;;;;;;;;nCmdCount= 10;
movlw 10
movwf nCmdCount ;not sure if these 4 are right
;;;;;;;;;;"c";;;;;;;;;;;nA8 = 3;
movlw 3
movwf nA8
;;;;;;;;;;"c";;;;;;;;;;;;;;;;nB8 = 4;
movlw 4
movwf nB8
;??????????????????????????????????????????????????????????????????????
;??????????????????????????????????????????????????????????????????????
clrf n_bytes
sync_up: clrf counter
sync_loop: btfss LANC
goto sync_up
nop
incfsz counter, same
goto sync_loop
synced: clrf n_bytes
wait_strt: btfsc LANC
goto wait_strt
start_bit: movlw 15
movwf counter
l1: decfsz counter, same
goto l1
;?????????????????????????????????????????????????????????????????????????????
btfsc LANC ;btfsc
goto PROBLEM_2 ;error turn on red LED skip if lanc is clrf
;????????????????????????????????????????????????????????????????????????????????
movlw 8
movwf n_bits ;n_bits=8
wait_bits: movlw 15
movwf counter
l2: decfsz counter, same
goto l2
send_bits: btfss general_flags, command_tx
goto wait_half
btfss send_reg, lsb
goto send_0
send_1: bcf LANC
banksel TRISC ;bsf STATUS, RP0
movlw OUTPUT_PINS
movwf TRISC
nop
nop
goto bit_sent
send_0: bsf LANC ;set lanc and make input for reading
banksel TRISC ;bsf STATUS, RP0
movlw INPUT_PINS
movwf TRISC
bcf STATUS, RP0
nop
nop
bit_sent: rrf send_reg, same ;shift out bits
movlw 10
goto jump_half
wait_half: movlw 15
jump_half:
movwf counter
l3: decfsz counter, same
goto l3
read_bits:
rrf recv_reg, same ;read bits
bcf recv_reg, msb
btfss LANC ;if Lanc is low set next
bsf recv_reg, msb
nop
nop
decfsz n_bits, same ;read 8 bits
goto wait_bits
wait_stop: movlw 14
movwf counter
l4: decfsz counter, same ;count down from 14
goto l4
send_stop: btfss general_flags, command_tx
goto wait_half_stop
bsf LANC
bsf STATUS, RP0
movlw INPUT_PINS
movwf TRISC
bcf STATUS, RP0 ;???????banksel
bcf general_flags, command_tx
movlw 11
goto jump_half_stop
wait_half_stop:
movlw 14
jump_half_stop:
movwf counter
l5: decfsz counter, same
goto l5
read_stop: bsF LANC
count:
incf n_bytes, same
decf n_bytes, w
andlw 07
addwf PC, same
goto check_0
goto check_1
goto check_2
goto check_3
goto check_4
goto check_5
goto check_6
goto check_7
check_0:
btfsC send_command, 0
goto wait_strt
send_commandS:
movlw PHOTO
movwf send_reg
movlw SEND_CMD
movwf general_flags
goto wait_strt
check_1:
btfss status_byte, BitStatus2
goto wait_strt
send_43:
movf special_word, no_same
movwf send_reg
movlw SEND_CMD
movwf general_flags
goto wait_strt
check_2:
btfsc status_byte, BitStatus0
goto status_0
btfsc status_byte, BitStatus1
goto status_1
btfsc status_byte, BitStatus3
goto status_2
goto wait_strt
status_0:
movlw 0
addwf recv_reg, no_same
btfsc STATUS, Z_BIT
incf nEmpty, same
goto wait_strt
status_1:
movlw 0x47
subwf recv_reg, no_same
btfsc STATUS, Z_BIT
incf nB8Count
goto wait_strt
status_2:
movlw 0x57
subwf recv_reg, no_same
btfsc STATUS, Z_BIT
incf nA8Count
goto wait_strt
check_3:
goto wait_strt
check_4:
goto wait_strt
check_5:
goto wait_strt
check_6:
goto wait_strt
check_7:
btfss status_byte, Bit0ECommand
goto begin_spare
movlw COMMAND_0E
movwf send_reg
movlw SEND_CMD
movwf general_flags
begin_spare:
btfsc status_byte, BitStatus0
goto spare_status_0
btfsc status_byte, BitStatus1
goto spare_status_1
btfsc status_byte, BitStatus2
goto spare_status_2
btfsc status_byte, BitStatus3
goto spare_status_3
goto end_spare
spare_status_0:
movlw EMPTY_COUNT
subwf nEmpty, no_same
btfss STATUS, Z_BIT
goto end_spare
;// Change status
movlw 0x06
movwf status_byte
;// Send 0x0E command in next frame
movlw COMMAND_0E
movwf send_reg
movlw SEND_CMD
movwf general_flags
goto end_spare
spare_status_1:
movf nB8, no_same
subwf nB8Count, no_same
btfss STATUS, Z_BIT
goto end_spare
;// Change status
movlw 0x0A
movwf status_byte
movlw 3
movwf nB8
clrf nB8Count
spare_status_2: ;// Send AC, AC
btfsc status_response, Bit0
goto send_BC
btfsc status_response, Bit1
goto send_AC1
btfsc status_response, Bit2
goto send_AC2
send_BC:
movlw 0x02
movwf status_response
;// Prepare to send
movlw WORD1
movwf special_word
goto end_spare
send_AC1:
;// Change state
movlw 0x04
movwf status_response
;// Prepare to send
movlw WORD2
movwf special_word
goto end_spare
send_AC2:
;// Change state
movlw 0x01
movwf status_response
movlw 0x12
movwf status_byte
;// Prepare to send
movlw WORD2
movwf special_word
goto end_spare
spare_status_3: ;// Read A8's
movf nA8, no_same
subwf nA8Count, no_same
btfss STATUS, Z_BIT
goto end_spare
;// Change status
movlw 0x06
movwf status_byte
movlw 3
movwf nA8
clrf nA8Count
movlw 0xff
movwf photo_flag;
end_spare:
btfss photo_flag, 0x00
goto sync_up
;//movlw 0
;//movwf photo_flag;
bcf status_byte, Bit0ECommand
;//bsf status_byte, BitStatus4
movlw 0xFF
movwf send_command
pre_cmd:
;// Send 0x1E pre-command byte
movlw PRE_CMD_1E
movwf send_reg
movlw SEND_CMD
movwf general_flags
check_count:
decfsz nCmdCount, same
goto sync_up
end_cmd:
;// No more command. Restore state
movlw 10
movwf nCmdCount
;//bcf status_byte, BitStatus4
movlw 0
movwf send_command
bsf status_byte, Bit0ECommand
movlw COMMAND_0E
movwf send_reg
movlw SEND_CMD
movwf general_flags
movlw 0
movwf photo_flag
goto sync_up
PROBLEM_2
bsf RED
end
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?