Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Gave myself an xmas gift - OWON HDS1022M-N Scope

Status
Not open for further replies.
My keyboard or sys config doesnt let me use the dollar symbol.
A quid can last me 1.25 microseconds on bill day.
 
My keyboard or sys config doesnt let me use the dollar symbol.
A quid can last me 1.25 microseconds on bill day.
I think my family's ride on the London Eye was a quid per 1.25 uSec.
 
Same here, rather go for a ide on my push iron.
 
You can get Chinese copies for almost nothing at all, which probably do everything you need.


Reminds me of an old RS232 "smart cable" - maybe I can repurpose mine :)

RS232 123000.jpg


Actually, this one:


looks interesting.

But, back to the scope at hand.
 
So, I got a little distracted (sometimes I think that I have project ADD) and have not yet installed the PC software for the scope. Here is the story:

I was reading about some FFT functions on the scope and thought that it looked pretty cool to check out.

From there, I started to think about white noise generators and wayyyyyy back in 1991, I wrote a shift register (search for LFSR and PRNG) white noise generator on a PC. I had been reading Don Lancaster and he went into them extensively - good stuff. That code, I found:
Code:
;-----------------------------------------------------------------------
;  Shift register (31-bit) pseudorandom (white) noise generator
;-----------------------------------------------------------------------
%TITLE  "NOISE31.ASM"
        IDEAL
        DOSSEG
        MODEL   tiny
        DATASEG
shift_reg       dd      5a5aa55ah       ;a nice seed
speaker_off     db      0
speaker_on      db      0
welcome         db      0ah,0dh
db '  NOISE31 - A "white" noise generator based on a 31-bit shift'
db ' register',0dh,0ah
db '            (as suggested by Don Lancaster).',0ah,0dh,0ah,0dh
db 0ah,0dh,'                    -  -----------------------------   -'
db 0ah,0dh,'                    -       Done For Fun by:           -'
db 0ah,0dh,'                    -       xxxxxxxxxxxxxxxxxxxxxxxx   -'
db 0ah,0dh,'                    -       xxxxxxxxxxxxxxxxxxxxxxxx   -'
db 0ah,0dh,'                    -       xxxxxxxxxxxxxxxxxxxxxxxx   -'
db 0ah,0dh,'                    -  -----------------------------   -'
db 0ah,0dh,0ah,0dh
db '                          (Press any key to Exit)',0ah,0dh
db '$'
        CODESEG
        ORG     100h
start:
        mov     ax,02h                  ;clear the screen
        int     10h
        mov     dx,offset welcome       ;display message
        mov     ah,09h
        int     21h
;get speaker_off setting
        mov     dx,61h                  ;speaker port
        in      al,dx
        and     al,0fch
        mov     [speaker_off],al        ;save speaker off
        out     dx,al                   ;start it off
        or      al,02h
        mov     [speaker_on],al
gen_num:
;Determine the result of (bit three xor bit six) of the high
; byte of the shift register and put the result in the carry.
        mov     bx,[WORD HIGH shift_reg]
        and     bh,048h                 ;08h or 40h is result=1 else 0
        cmp     bh,08h
        jz      xor1
        cmp     bh,40h
        jz      xor1
        clc                             ;xor result=0 so clear carry
        mov     al,[speaker_off]        ;and set speaker byte
        jmp     short shift_bits
xor1:
        stc                             ;xor result=1 so set carry
        mov     al,[speaker_on]         ;and set speaker byte
;Rotate the shift register with the cf becoming the lsb.
shift_bits:
        rcl     [WORD LOW shift_reg],1
        rcl     [WORD HIGH shift_reg],1
;The cf has our random bit but al has our speaker out byte.
;toggle speaker
        out dx,al       ;out the speaker
;check for a key press to end
@@10:
        mov     ah,1
        int     16h
        jz      short gen_num   ;no press
        mov     ah,0
        int     16h             ;trash press
        mov     ah,4ch
        int     21h             ;-->DOS
        END     start

But, there is more. Advancing the clock many years, I had a need for a white noise generator for masking noise (not signal stuff). No desire to dedicate a PC to that and Radio Shack was selling the MM5837, so I got one of those (maybe some old-timers here remember it)..

To put it mildly, they suck. Among other things, there is a distinct "click" when they cycle. After a while, that was all I could hear - shhhhhhhh *click shhhhhh * click.

So, after wasting some time and effort, I went searching and found this site. The fellow there had made a "replacement" using a PIC12F675. I programmed one using his code and, for what I wanted, it worked pretty darn good. Hooked it up to a commercial amplifier, and we used it for years.

I was thinking about that and I thought that, at some point, I had translated the code to a PIC10F202, but for the life of me, I could not find that. I find code from 39 29 years ago, but not from 5 years ago?!?!

Stuck on that, I decided to do the translation (not difficult at all) and program a couple (I must have a good 10 PIC10F202s).

Here is the code:
Code:
;----------------------------------------------------------------------
; Translation of a white noise generator from PIC12F675 to PIC10F202
; Original code from: https://electricdruid.net/white-noise-source/      
;              by  Tom Wiltshire
; GP2 pin 3 (on 8p pdip has the output to be consistent with the
; MM5837 - other output pins are possible
;----------------------------------------------------------------------
    LIST P=10F202
    include "p10f202.inc"
    __CONFIG  _MCLRE_OFF & _CP_OFF & _WDT_OFF
;
; RAM Variables
CBLOCK 0x08
; LFSR 1, a 31-bit register
    LFSR1_1
    LFSR1_2
    LFSR1_3
    LFSR1_4
; LFSR 2, a 23-bit register
    LFSR2_1
    LFSR2_2
    LFSR2_3
; Temporary storage
    TEMP
ENDC
;----------------------------------------------------
    org     0x000           
    movwf   OSCCAL
; note: use default OPTION reg values
    movlw    b'11011100' ; for GP2 out
    OPTION              
;**** Setup GPIO inputs/outputs ****
    movlw    b'00000000'
    movwf    GPIO
    movlw    b'00001011' ; GP2 as output (pin 3 on 8p pdip)
    TRIS    GPIO
; Set up initial values of the registers
    movlw    0x45
    movwf    LFSR1_1
    movlw    0x57
    movwf    LFSR1_2
    movlw    0x9F
    movwf    LFSR1_3
    movlw    0xF2
    movwf    LFSR1_4
    movlw    0xD7
    movwf    LFSR2_1
    movlw    0xC8
    movwf    LFSR2_2
    movlw    0x79
    movwf    LFSR2_3
MainLoop:
; 31-bit LFSR with taps at 31 and 28
    swapf    LFSR1_4, W    ; Get bit 28
    movwf    TEMP
    rlf        LFSR1_4, W    ; Get bit 31
    xorwf    TEMP, F
; Shift the XORd bit into carry
    rlf        TEMP, F
; Shift the register
    rlf        LFSR1_1, F
    rlf        LFSR1_2, F
    rlf        LFSR1_3, F
    rlf        LFSR1_4, F
; Output the noise bit
    movf    LFSR1_1, W
    movwf    GPIO
; 21-bit LFSR with taps at 21 and 19
    rrf        LFSR2_3, W    ; Get bit 19
    movwf    TEMP
    rrf        TEMP, F
    swapf    LFSR2_3, W    ; Get bit 21
    xorwf    TEMP, F
; Shift the XORd bit into carry
    rrf        TEMP, F
; Shift the register
    rlf        LFSR2_1, F
    rlf        LFSR2_2, F
    rlf        LFSR2_3, F
; Output the noise bit
    movf    LFSR2_1, W
    movwf    GPIO
    goto    MainLoop
    END

So, that is what I used to play around with the scope and FFT.
 
Last edited:
Here is what the output looks like:
PRNG1 91607.jpg


and you can do some averaging:
PRNG2_391723.jpg


and on the FFT screen a dB plot
PRNG3_391357.jpg


There is a lot to this and I keep getting these "oh yeah I remember that stuff" moments ;)
 
Installed the PC software. Seems OK, nothink spectacular but I have not gone through it extensively.

I was able to load .bin files and the save as much larger .bmps (a few other options). This one is an example (made into a smaller .jpg for posting).

test2.jpg



All in all, I declare the purchase a success. I think I have figured out enough to start using it when I need/want to. Good Deal!
 
As far as the logic analyzer goes, you can get a little USB dongle or one of the Cypress PSOC eval boards off of Amazon for ~$13 USD. If you get it via China it'll be less of course.
As far as the software goes, Sigrok is what you want to be using. Some of the clones(some of the dongles) ship with a Saleae VID/PID, but recently some have started using an Open Source VID/PID. In both cases Sigrok uses it's own firmware unless you tell it otherwise.
Sigrok decodes just about everything out there, the list is huge.
In either case, if it's one of cheap 8 channel/24Mhz units, I suggest adding some protection, as the PSOC will only handle 3.3V. I ended up using a combination of a 74LVC245 as a buffer along with 2 4-line protection arrays to protect from signals higher than the 5.5V the 245 could handle.
 
I just installed sigrok, looking forward to playing with it.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top