REGBASE EQU $1000
SPCR EQU $1028
BAUD EQU $102B
SCCR1 EQU $102C
SCCR2 EQU $102D
SCSR EQU $102E
SCDR EQU $102F
ORG $0100
START LDAA #%00110000 ; 00110000 = 9600 BAUD
STAA BAUD ; 00110011 = 1200 BAUD
CLR SCCR1
LDAA #$0C
STAA SCCR2 ;RECEIVER & TRANS. ENABLED
clr SPCR
LOOP
ldaa #72 ; send "H" to serial
read_again ldab $102e ;
bitb #$80
beq read_again
staa SCDR ;
ldaa #101 ; send "e" to serial
read_again ldab $102e ;
bitb #$80
beq read_again
staa SCDR ;
ldaa #108 ; send "l" to serial
read_again ldab $102e ;
bitb #$80
beq read_again
staa SCDR ;
ldaa #108 ; send "l" to serial
read_again ldab $102e ;
bitb #$80
beq read_again
staa SCDR ;
ldaa #111 ; send "o" to serial
read_again ldab $102e ;
bitb #$80
beq read_again
staa SCDR ;
ldaa #32 ; send "space" to serial
read_again ldab $102e ;
bitb #$80
beq read_again
staa SCDR ;
BRA LOOP
Why is there no headers and checksum in the serial output?
Does it mean the source has headers and checksum disabled?
the ARM?
What particular ARM do you own?
Why is there no headers and checksum in the serial output?Because you did not program them.Does it mean the source has headers and checksum disabled?There is nothing to disable. You are really misunderstanding how UART works. There is no inherent structure. UART just sends individual bytes. You as a programmer decide what they mean. You may decide that a first byte of all your messages would be '#' and this would be your "header". This is not something you absolutely have to do. You may just dump plain text and then you won't need any headers.the ARM?ARM is just a core architecture, specific peripheral details depends on a device based on that architecture. Generally, ARM is more complicated, since it is way more capable. And nobody programs in ASM anyway.What particular ARM do you own?I "own" dozens of devices. It is not something I idly play with, I use whatever is best suited for a particular project.
With your current level of understanding there is no chance you will be able to use ARM-based devices. It requires reading of documentation and you refuse to do that.
What is the fastest most advanced 32 bit microcontroller you know that has assembly very similar to the 68HC11 Assembly Language?
Code: [Select]REGBASE EQU $1000
SPCR EQU $1028
BAUD EQU $102B
SCCR1 EQU $102C
SCCR2 EQU $102D
SCSR EQU $102E
SCDR EQU $102F
ORG $0100
START LDAA #%00110000 ; 00110000 = 9600 BAUD
STAA BAUD ; 00110011 = 1200 BAUD
CLR SCCR1
LDAA #$0C
STAA SCCR2 ;RECEIVER & TRANS. ENABLED
clr SPCR
LOOP
ldaa #72 ; send "H" to serial
read_again ldab $102e ;
bitb #$80
beq read_again
staa SCDR ;
ldaa #101 ; send "e" to serial
read_again ldab $102e ;
bitb #$80
beq read_again
staa SCDR ;
ldaa #108 ; send "l" to serial
read_again ldab $102e ;
bitb #$80
beq read_again
staa SCDR ;
ldaa #108 ; send "l" to serial
read_again ldab $102e ;
bitb #$80
beq read_again
staa SCDR ;
ldaa #111 ; send "o" to serial
read_again ldab $102e ;
bitb #$80
beq read_again
staa SCDR ;
ldaa #32 ; send "space" to serial
read_again ldab $102e ;
bitb #$80
beq read_again
staa SCDR ;
BRA LOOP
What is the fastest most advanced 32 bit microcontroller you know that has assembly very similar to the 68HC11 Assembly Language?I have no idea how HC11 assembly looks like. You can program any modern MCU in assembly, includeing all ARM-based MCUs, it is just incredibly inconvenient and slow. But if all you are going to be doing are those 20-line tiny programs, then any would work. And you would have hard time finding example code, since nobody does that.
You would still need to read MCU documentation. And it is generally pretty long for modern devices.
And the amount of C you need to learn is minimal. And you are still going to have to learn a different variety of assembly, I can guarantee that nothing would be exactly like HC11.
The argument "it does not make me money" is also strange. Nothing would make you money until you learn it enough to start extracting that money.
(oscar, I ran it using AS11.EXE. THRSIM11 simulator can't run them if the labels have duplicates. I'll try using different labels and and ran them again in AS11.EXE)
the same C program can run in all of your MCUs??
That means what appear to be very complicated machine code in the MSP430 can be easily converted to C++ and understood more easily? But most MCUs use C only, and not C++.
Also if someone say in China stole your firmware and you live in the US, how are you gonna sue him in China?
the same C program can run in all of your MCUs??No. You really need to let go of HC11. There is literally nothing like it anymore. None. If you are going to measure everything by how much it looks like HC11, then you can't use anything.That means what appear to be very complicated machine code in the MSP430 can be easily converted to C++ and understood more easily? But most MCUs use C only, and not C++.Ghidra output is not useful directly. It is just a rough sketch of what the program might look like, it never actually compiles back to the useful code.
C is just a generic language. The difference between MCUs is in the peripherals. And again, this is a concept you need to understand well before programming anything. you won't be able yo do anything until you do.Also if someone say in China stole your firmware and you live in the US, how are you gonna sue him in China?You don't. But you can prevent import of that product to the US. It would require a lot of effort, but it is possible.
(oscar, I ran it using AS11.EXE. THRSIM11 simulator can't run them if the labels have duplicates. I'll try using different labels and and ran them again in AS11.EXE)
The ancient version of AS11 I have here from the days I used to tinker with HC11 does complain. If something does not complain, then I can only guess that maybe later use of the same symbol replaces the earlier one from that point onward (and you would have to be very careful not to get yourself into trouble with that).
Really that code should be in a subroutine, rather than repeating it every time.
Oscar. You are few of the people I know who is familiar with the HC11. So please don't miss the reply to the above (I'll repost this here and delete the reply an hour ago)
I run As11.exe now. It doesn't complain and correctly jumps to the label just above it. That's why it could still output the txt "Hello". I also changed all labels to unique ones. And the same. I know unique labels are important because I was lost in the loop late last year until I discovered the duplicate labels can miss things up. As11.exe doesn't report any error.
27: Symbol Redefined
33: Symbol Redefined
39: Symbol Redefined
45: Symbol Redefined
51: Symbol Redefined
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_again1 ldab $102e ;
0028 0121 c5 80 bitb #$80
0029 0123 27 f9 beq read_again1
0030 0125 b7 10 2f staa SCDR ;
0031
0032 0128 86 6c ldaa #108 ; send "l" to serial
0033 012a f6 10 2e read_again2 ldab $102e ;
0034 012d c5 80 bitb #$80
0035 012f 27 f9 beq read_again2
0036 0131 b7 10 2f staa SCDR ;
0037
0038 0134 86 6c ldaa #108 ; send "l" to serial
0039 0136 f6 10 2e read_again3 ldab $102e ;
0040 0139 c5 80 bitb #$80
0041 013b 27 f9 beq read_again3
0042 013d b7 10 2f staa SCDR ;
0043
0044 0140 86 6f ldaa #111 ; send "o" to serial
0045 0142 f6 10 2e read_again4 ldab $102e ;
0046 0145 c5 80 bitb #$80
0047 0147 27 f9 beq read_again4
0048 0149 b7 10 2f staa SCDR ;
0049
0050 014c 86 20 ldaa #32 ; send "space" to serial
0051 014e f6 10 2e read_again5 ldab $102e ;
0052 0151 c5 80 bitb #$80
0053 0153 27 f9 beq read_again5
0054 0155 b7 10 2f staa SCDR ;
0055
0056 0158 20 b6 BRA LOOP
Anyway. I think you missed the reply (dated January 28) to your query about Trace. After reading about your Trace thing. I connected jumper XIRQ and PA3, and saw Trace worked for the first time.
...
Again. I wrote and asked in that January 28 message (pls answer it, thanks).
"A while ago. I used the trace function in Buffalo for the first time. It worked so nice. Didn't know the unit could really do that. But I noticed that whenever it passed through an interrupt enable (for example the CLI which enabled the Real Time Interrupt) . The trace got stuck on the next instruction"
1. Why did it get stuck after passing through instruction that enabled the interrupt? How do you proceed after it got stuck?
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).
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).
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.
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
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
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: [Select]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
For what you were doing, which of those do you think makes the most sense?
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)
Assembled hw.txt (56 lines) 90 bytes, RAM: 0, CRC: $EEF8
1 file processed! (Elapsed time: 0:00:00)
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.
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.
Is there a Ghidra reverse engineering that can hack all software too?
Don't worry.
By the way. what is your area of expertise along the line of programming embedded circuits and MCUs?
"Seeing entanglement in the brain