Electronics > Microcontrollers

PIC18F1320 in a Raman Spectrometer

<< < (14/14)

planc:

--- Quote from: ozcar on February 07, 2023, 11:24:17 am ---
--- Quote from: planc on February 07, 2023, 10:54:14 am ---If the filename is hw.txt with the multiple identical read_again labels. I used the following commands to compile in ms dos

as11 hw.txt   
or
as11 hw.txt -1 >hw.1st

The hw.1st is empty when there is no error, and it successfully compiled to hw.s19 which I can run in the HC11.

How do you show the listing with the address 0001 1000..    0009 0100??  I'll try to reproduce that listing because I haven't seen it before (address listed).


--- End quote ---

I was using -L option on the command, so similar to your command, but in upper case. I just tried it now with -l instead, and that works too. If I don't use either, I just get an empty file. Maybe there is some way to set up defaults for the options, but it is so long since I was using this that I have forgotten.

But it seems the AS11 you have may be different.

--- End quote ---

Oh my gosh. I just realized I had been using the wrong switch the whole 4 months I was using the HC11. I used number one 1 instead of L in the -L (I used -1). When I used the right -L now. It also listed it. But no error. I ran

As11 hw.txt -L >hw.1st


--- Code: ---0001 1000                    REGBASE EQU $1000
0002 1028                    SPCR    EQU $1028
0003 102b                    BAUD    EQU $102B
0004 102c                    SCCR1   EQU $102C
0005 102d                    SCCR2   EQU $102D
0006 102e                    SCSR    EQU $102E
0007 102f                    SCDR    EQU $102F
0008                         
0009 0100                                    ORG     $0100
0010                         
0011 0100 86 30              START LDAA #%00110000      ;    00110000 = 9600 BAUD
0012 0102 b7 10 2b            STAA BAUD            ;    00110011 = 1200 BAUD
0013 0105 7f 10 2c            CLR SCCR1
0014 0108 86 0c              LDAA #$0C
0015 010a b7 10 2d            STAA SCCR2           ;RECEIVER & TRANS. ENABLED
0016 010d 7f 10 28            clr SPCR
0017                         
0018                         LOOP
0019                         
0020 0110 86 48                              ldaa    #72           ; send "H" to serial
0021 0112 f6 10 2e           read_again      ldab $102e           ;
0022 0115 c5 80              bitb    #$80
0023 0117 27 f9              beq read_again
0024 0119 b7 10 2f            staa SCDR           ;
0025                         
0026 011c 86 65                              ldaa    #101           ; send "e" to serial
0027 011e f6 10 2e           read_again     ldab $102e           ;
0028 0121 c5 80              bitb    #$80
0029 0123 27 f9              beq read_again
0030 0125 b7 10 2f            staa SCDR           ;
0031                         
0032 0128 86 6c                              ldaa    #108          ; send "l" to serial
0033 012a f6 10 2e           read_again      ldab $102e           ;
0034 012d c5 80              bitb    #$80
0035 012f 27 f9              beq read_again
0036 0131 b7 10 2f            staa SCDR           ;
0037                         
0038 0134 86 6c                              ldaa    #108           ; send "l" to serial
0039 0136 f6 10 2e           read_again     ldab $102e           ;
0040 0139 c5 80              bitb    #$80
0041 013b 27 f9              beq read_again
0042 013d b7 10 2f            staa SCDR           ;
0043                         
0044 0140 86 6f                              ldaa    #111          ; send "o" to serial
0045 0142 f6 10 2e           read_again      ldab $102e           ;
0046 0145 c5 80              bitb    #$80
0047 0147 27 f9              beq read_again
0048 0149 b7 10 2f            staa SCDR           ;
0049                         
0050 014c 86 20                              ldaa    #32          ; send "space" to serial
0051 014e f6 10 2e           read_again    ldab $102e           ;
0052 0151 c5 80              bitb    #$80
0053 0153 27 f9              beq read_again
0054 0155 b7 10 2f            staa SCDR           ;
0055                         
0056 0158 20 b6              BRA     LOOP

--- End code ---

It's that awful when you just learnt a new fact when you are about to leave something behind. It could have helped me all those months learning the HC11 and trying to recover and learn how the firmware worked.

If you know where you got your AS11 or can upload it to a file directory somewhere, please do because my As11.exe didn't show error when multilple identical labels were used. But if wrong instructions used, it can show error like yours.

ozcar:
From that assembly listing, you can see what it has done with the duplicate symbols. Look at the generated code for each instruction as shown on the left, you can see that all the "beq read_again"  instructions assemble as "27 f9" (shown in hexadecimal, of course).The 27 is the opcode for beq, and the f9 (minus 7 in decimal) is the offset, relative to the next instruction, to branch to. So, it has created code that does what you want, but to me just doing that silently is a big trap for the unwary - think what could happen if you accidentally used the same symbol twice.

I don't remember where I got AS11 from. I have it in a directory together with the Axiom IDE  (I had one of their boards), so perhaps it was bundled with that.

You could use asm11.exe from http://www.aspisys.com/asm11.htm ("Click title for binaries" link) instead. That even runs natively on current Windows versions, something that AS11 (at least the one I have) does not. The listing produced by that gives some additional information too, like the cycle counts for each instruction.

For today's assembly language lesson, take a look at the generated code for these four instructions:


--- Code: ---0020 0110 86 48                              ldaa    #72            ; send "H" to serial
0021 0112 86 48                              ldaa    #$48           ; send "H" to serial
0022 0114 86 48                              ldaa    #%01001000     ; send "H" to serial
0023 0116 86 48                              ldaa    #'H'           ; send "H" to serial

--- End code ---

For what you were doing, which of those do you think makes the most sense?

planc:

--- Quote from: ozcar on February 07, 2023, 08:43:10 pm ---From that assembly listing, you can see what it has done with the duplicate symbols. Look at the generated code for each instruction as shown on the left, you can see that all the "beq read_again"  instructions assemble as "27 f9" (shown in hexadecimal, of course).The 27 is the opcode for beq, and the f9 (minus 7 in decimal) is the offset, relative to the next instruction, to branch to. So, it has created code that does what you want, but to me just doing that silently is a big trap for the unwary - think what could happen if you accidentally used the same symbol twice.

I don't remember where I got AS11 from. I have it in a directory together with the Axiom IDE  (I had one of their boards), so perhaps it was bundled with that.

You could use asm11.exe from http://www.aspisys.com/asm11.htm ("Click title for binaries" link) instead. That even runs natively on current Windows versions, something that AS11 (at least the one I have) does not. The listing produced by that gives some additional information too, like the cycle counts for each instruction.

For today's assembly language lesson, take a look at the generated code for these four instructions:


--- Code: ---0020 0110 86 48                              ldaa    #72            ; send "H" to serial
0021 0112 86 48                              ldaa    #$48           ; send "H" to serial
0022 0114 86 48                              ldaa    #%01001000     ; send "H" to serial
0023 0116 86 48                              ldaa    #'H'           ; send "H" to serial

--- End code ---

For what you were doing, which of those do you think makes the most sense?

--- End quote ---

I'm familiar with the first 3 lines, but I never tried "#'H'. The reason I was so familiar with the first 3 lines was because I had to learn to and distinguish them to even understand what the EEG firmware is doing, and after knowing them, figuring out the missing codes the manufacturer deleted on purpose.

They reason they bricked the old 1999 EEG unit was because it was once free to use. Now you must pay for limited time use and very expensive. When I bought it in 1999 I didn't even use it. I  planned to explore it last year October and I ran the manufacturer latest software which bricked them. Fortunately. My old software in a 1.44M diskette still worked after 22 years. I How long is the 1.44M diskette you have tried to read and no bad sectors?  Then I open the unit and found out it has an HC11 inside and I read everything about HC11 until I know how to write simple codes, and analyze loops. The THRsim11 has helped me a lot. Also in the 7 pages firmware. Only 3 are required, the rest creates many loops that are meant to confuse those who are seeing the firmware. It took me 2 weeks to analyze them after writing each register on paper and tracing the loop. And usng THRsim11 simulator. Had I know how to trace in Buffalo that time, It could have helped me a lot.

If you used identical label names inside loop. It can jump incorrectly, and it took 2 days to discover it last November. In the latest asm11 copy you shared above. The following is the error now. (the reason I still use multiple labels is just to quickly display Hello at serial, that's why I didn't use any subroutine for the serial which I know how to do. I don't use the Hc11 for other purposes except just exploring the EEG thing and I forgot about not using multiple labels because my AS11 copy not showing error.. Ataradov kept asking me why I still use the HC11. It's primarily to fix the bricked EEG which I did successfully):


--- Code: ---C:\Users\AlbeP\Downloads\asmw32\hw.txt(27): Error: Possibly duplicate symbol "read_again"
C:\Users\AlbeP\Downloads\asmw32\hw.txt(33): Error: Possibly duplicate symbol "read_again"
C:\Users\AlbeP\Downloads\asmw32\hw.txt(39): Error: Possibly duplicate symbol "read_again"
C:\Users\AlbeP\Downloads\asmw32\hw.txt(45): Error: Possibly duplicate symbol "read_again"
C:\Users\AlbeP\Downloads\asmw32\hw.txt(51): Error: Possibly duplicate symbol "read_again"
Assembled hw.txt (56 lines)          [Errs: 5]
1 file processed! (Elapsed time: 0:00:00)

--- End code ---

The following is when  the loop has unique names


--- Code: ---Assembled hw.txt (56 lines)                                                            90 bytes, RAM:     0, CRC: $EEF8
1 file processed! (Elapsed time: 0:00:00)

--- End code ---

What web sites can one upload files that you can download? The as11 is open source. I want to upload you my as11 copy which doesn't show any error even if all identical labels used. It can run only in 32bit Windows DOS.  Your as11 link is great because I can now run it in my 64 bit windows without having to use Oracle Virtual box just to run it in windows 32 bit and dos.

My Microsoft Surface Pro 7 can only run Windows 64 bit and not 32 bit. But with your programming skill guys, can you share how to run windows 32 bit in the Microsoft Surface notebooks?

planc:

--- Quote from: ataradov on February 07, 2023, 06:33:53 am ---Well, UART is a peripheral, so it would be different between different MCUs. So, you can't take C code for one MCU and compile it for another MCU without changing device-specific parts.

You've already been pointed at a few MCUs that have higher resolution SDADC. Those may or may not be good enough for your application.

Even if you fond some readily available eval board with 24-bit ADC and a MCU (there are not too many of those, I imagine), all the example code would be in C. And it is not likely that example code would do precisely what you want, so you would have to modify it anyway.

Internal ADCs in the MCUs are not meant for metrological applications.

But also, 24-bits is not about accuracy or resolution, but about dynamic range. If you don't need wide dynamic range, you can use low noise amplifier and use internal ADC just as well.

--- End quote ---

In your work, how often do you integrate pc software to the embedded MCU? If you can use password in the pc software that would be tied up with the serial number in your circuit or module. Then why be concerned the circuit and firmware are copied when they don't have your pc software source code?  Is there a Ghidra reverse engineering that can hack all software too?

Btw..I will no longer reverse engineer the Raman spectrometer or EEG and will move from the 68HC11. I don't want to offend those manufacturers too. I heard they can get you if there is an extradition treaty between the United States and that country? And I will not hack any software too Don't worry. Instead I'll focus on my interests in the brain and physics. I have over 50 books of the brain, and nearly 300 on physics, and interested in biophysics as I've been trying to understand why emotions are contagious and how people can affect one another non-locally and something nonphysical is also feeding on the emotions and provoking violence (like when soldiers killed civilians en masse). The following headlines about quantum entanglement detected in the brain will let me review it all (I wonder what kind of MCU and ADC is inside MRI, any clue?0. By the way. what is your area of expertise along the line of programming embedded circuits and MCUs?

https://www.freethink.com/science/consciousness-quantum-entanglement?utm_source=facebook&utm_medium=social&utm_campaign=BigThinkdotcom&fbclid=IwAR1q_d5W7NbWiIh_a9QBwDgF6Kq3gahEwIHKPjViG59cn8YUwbbdJzQrKzs

"Seeing entanglement in the brain may show that the brain is not classical, as previously thought, but rather a powerful quantum system. If the results can be confirmed, they could provide some indication that the brain uses quantum processes. This could begin to shed light on how our brain performs the powerful computations it does, and how it manages consciousness."

https://iopscience.iop.org/article/10.1088/2399-6528/ac94be

"Our findings suggest that we may have witnessed entanglement mediated by consciousness-related brain functions. Those brain functions must then operate non-classically, which would mean that consciousness is non-classical."


ataradov:

--- Quote from: planc on February 09, 2023, 10:00:23 am ---In your work, how often do you integrate pc software to the embedded MCU?

--- End quote ---
Never.


--- Quote from: planc on February 09, 2023, 10:00:23 am --- If you can use password in the pc software that would be tied up with the serial number in your circuit or module.

--- End quote ---
If I clone your hardware, I would just clone the same serial number and then distribute a single known password that works with that SN.


--- Quote from: planc on February 09, 2023, 10:00:23 am ---Is there a Ghidra reverse engineering that can hack all software too?

--- End quote ---
Ghidra works with PC software too. And there are a ton of other tools. You can forget about locking down the PC software. It is impossible to do.


--- Quote from: planc on February 09, 2023, 10:00:23 am ---Don't worry.

--- End quote ---
I'm not worried, based on this thread, there is no chance of you successfully reverse-engineering anything. You are pretty safe here.


--- Quote from: planc on February 09, 2023, 10:00:23 am ---By the way. what is your area of expertise along the line of programming embedded circuits and MCUs?

--- End quote ---
Why?


--- Quote from: planc on February 09, 2023, 10:00:23 am ---"Seeing entanglement in the brain

--- End quote ---
I'm done here. I don't do quack pseudo-science.

Navigation

[0] Message Index

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod