In SX Microcontrollers, SX/B Compiler and SX-Key Tool, sammishal wrote: Hey BPM, I have tried this code in SX/B, it compiled and loaded on the SX and ran I did not test it with actual connection to anything though. Here is the code and the .LST file with it. If you can make heads or tails of the code that is generated you are a better man than me. I am going to be loosing whatever grey cells are left in my already tiny brain to figure this out. :confused: Here is the stuff, let me know what you make of it. ===============Basic Code========================== DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX FREQ 4_000_000 Testin var byte PROGRAM Start Pgm_ID: Start: Main: ShiftIn RB.0,RB.1,MSBPRE,Testin GOTO Main ============Assembly code============================ 1 ; *** COMPILED WITH SX/B VERSION 1.21 04/27/2005 *** 2 3 071B 0F7F DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX ;DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX 4 5 ; DEFINE SYSTEM VARIABLES 6 =00000000 __RAM EQU $00 7 =00000004 __PARAMCNT EQU FSR 8 =00000008 __PARAM1 EQU $08 9 =00000009 __PARAM2 EQU $09 10 =0000000A __PARAM3 EQU $0A 11 =0000000B __PARAM4 EQU $0B 12 =000000FA __TRISA EQU $FA 13 =000000FA TRIS_A EQU $FA 14 =000000FB __TRISB EQU $FB 15 =000000FB TRIS_B EQU $FB 16 =000000FC __TRISC EQU $FC 17 =000000FC TRIS_C EQU $FC 18 =000000F5 __INTPARAMFSR EQU $F5 19 =00000008 __REMAINDER EQU $08 20 21 ; Define ShiftIn & ShiftOut Constants 22 =00000000 LSBFIRST EQU 0 23 =00000001 MSBFIRST EQU 1 24 =00000000 MSBPRE EQU 0 25 =00000001 LSBPRE EQU 1 26 =00000002 MSBPOST EQU 2 27 =00000003 LSBPOST EQU 3 28 29 30 =003D0900 FREQ 4_000_000 ;FREQ 4_000_000 31 =00000004 __FREQMHZ EQU 4 32 33 34 =0000000C Testin EQU 0x0C ; Testin var byte 35 36 07FF 0A00 RESET __PROGSTART ; PROGRAM Start 37 =00000000 __PROGSTART: 38 0000 0783 JNB TO,@__RESTORETRIS 0001 0010 0A28 39 0003 0663 JB PD,@__POWERUP 0004 0010 0A15 40 0006 0040 CLR W 41 0007 0059 MODE $09 42 0008 0006 MOV !RB,W 43 0009 0024 MOV FSR,W 44 000A 005F MODE $0F 45 000B 0C00 CJE FSR,#0,@__POWERUP 000C 0084 0643 0010 0A15 46 0010 0CFF CJNE FSR,#$FF,@__RESTORETRIS 0011 0084 0743 0010 0A28 47 =00000015 __POWERUP: 48 0015 0065 CLR RA 49 0016 0066 CLR RB 50 0017 0067 CLR RC 51 0018 0C08 MOV FSR,#$08 0019 0024 52 001A 0764 SB FSR.3 53 001B 0584 SETB FSR.4 54 001C 0060 CLR IND 55 001D 03E4 IJNZ FSR,@$-3 001E 0010 0A1A 56 0020 0CFA MOV FSR,#TRIS_A 0021 0024 57 0022 0CFF MOV IND,#255 0023 0020 58 0024 02A4 INC FSR 59 0025 0020 MOV IND,W 60 0026 02A4 INC FSR 61 0027 0020 MOV IND,W 62 =00000028 __RESTORETRIS: 63 0028 0CFA MOV FSR,#TRIS_A 0029 0024 64 002A 0200 MOV !RA,IND 002B 0005 65 002C 02A4 INC FSR 66 002D 0200 MOV !RB,IND 002E 0006 67 002F 02A4 INC FSR 68 0030 0200 MOV !RC,IND 0031 0007 69 0032 0064 CLR FSR 70 0033 0010 JMP @Start 0034 0A37 71 =00000037 ORG $+2 ; FOR DEBUGGER 72 73 =00000037 Pgm_ID: ;Pgm_ID: 74 75 76 =00000037 Start: ;Start: 77 78 79 =00000037 Main: ;Main: 80 81 0037 0CFB MOV FSR,#TRIS_B ; ShiftIn RB.0,RB.1,MSBPRE,Testin 0038 0024 82 0039 0500 SETB IND.0 83 003A 005F MODE $0F 84 003B 0420 CLRB IND.1 85 003C 0200 MOV !RB,IND 003D 0006 86 003E 0018 BANK $00 87 003F 006C CLR Testin 88 0040 0C08 MOV __PARAM2,#8 0041 0029 89 0042 0C05 MOV __PARAM3,#5 0043 002A 90 0044 02EA DJNZ __PARAM3,@$ 0045 0010 0A44 91 0047 0403 CLC 92 0048 036C RL Testin 93 0049 0706 MOVB Testin.0,RB.0 004A 040C 0606 050C 94 004D 0C02 XOR RB,#%00000010 004E 01A6 95 004F 0C05 MOV __PARAM3,#5 0050 002A 96 0051 02EA DJNZ __PARAM3,@$ 0052 0010 0A51 97 0054 0C02 XOR RB,#%00000010 0055 01A6 98 0056 02E9 DJNZ __PARAM2,@$-20 0057 0010 0A42 99 100 0059 0010 JMP @Main ; GOTO Main 005A 0A37 101 102 ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=103788#m103797 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)