hindi naman hijo, union is a standard C data type. Try it in CCS C or SDCC and they will not complain. They are designed to handle such complicated data structure. You can also put a structure inside a union.
Kung malaki naman ang RAM/ROM , why bother to save space? Once naman na nagkasya yung code mo sa chip - that's it! The important thing is that your project goal is achieved.
di ko pa rin ma-gets yang union na yan.. Cryang alam ko lang na union is yung group ng mga employees,yung group na magbo-boycott sa trabaho pag di maganda ang palakad ng company.. hehe Grin
..at ang dapat na inilalagay sa loob ng union ay mga tulad mong agresibo para sigurado, bankarote agad ang kompanya..
.. im agree talaga na di mo kaylangan ng maraming programming language para maging expert kundi mag focus ka lang sa isa o dalawa at kaalaman naman sa iba upang maging bihasa..
tito, pwede bang mag-apply sa company nyo ?
may advantage naman siguro (sa resume ) kung marami kang alam na programming language.. saka gusto ko lang ma-try ang mga different languages para malaman ko kung alin ang pinaka-efficient..
minsan ok rin maraming alam na programming language lalo na kung madalas ka sa mga ganitong site...http://www.getafreelancer.com
movf char, W xorlw 'A' skpnz goto process_A xorlw 'A' ^ 'B' skpnz goto process_B xorlw 'A' ^ 'B' ^ 'C' skpnz goto process_C xorlw 'A' ^ 'B' ^ 'C' ^ 'D' skpnz goto process_D goto not_valid
On Hitech, switch-case is more code efficient.Case comparisons are done via XORed values of the previous comparisons.
.. pero kalimitan ginagawa ko (lalo na pag alam kong hahaba ang switch case ko) is yung array function pointers.
switch x{case 0: mymeth(); break;case 1: myanothermeth(); break;default: breakl}
myfunctionarraypointer[x](); //myfunctionarraypointer is an array of function pointer to mymeth() and myanothermeth()
fn_array: andlw 0x03 ;ensure that we don't go to limbo addwf PCL,f goto func_0 goto func_1 goto func_2 return ;put a 'return' on unused slotfunc_0: ... returnfunc_1: ... return
In PIC assembly you could do similar and is leaner:Code: [Select]fn_array: andlw 0x03 ;ensure that we don't go to limbo addwf PCL,f goto func_0 goto func_1 goto func_2 return ;put a 'return' on unused slotfunc_0: ... returnfunc_1: ... return
;----------------------------------------------------------- MOVLW LOW FUNCTION_TABLE MOVWF TBLPTRL MOVLW HIGH FUNCTION_TABLE MOVWF TBLPTRH CLRF TBLPTRU; MOVF FUNCTION_NO,W ANDLW B'00000111' RCALL TOS_GOTOFUNCTION_TABLE: DW FUNCTION1 DW FUNCTION2 DW FUNCTION3 DW FUNCTION4 DW FUNCTION5 DW FUNCTION6 DW FUNCTION7 DW FUNCTION8FUNCTION_TABLE_END:;-----------------------------------------------------------TOS_GOTO: ADDWF WREG,W ; X2 ADDWF TBLPTRL,F SKPNC INCF TBLPTRH,F; TBLRD*+ MOVF TABLAT,W MOVWF TOSL; TBLRD*+ MOVF TABLAT,W MOVWF TOSH; RETURN;-----------------------------------------------------------