Wednesday, April 29, 2009

Microchip PIC SPI CKE and CPE vs. CPOL and CPHA

CKP = CPOL
CKE = opposite of CPHA
CKP     0               0               1               1            Clock Polarity
CKE     0               1               0               1            Clock Edge
        Idle Low        Idle Low        Idle High       Idle High 
        Change L->H     Change H->L     Change H->L     Change L->H 
        Read   H->L     Read   L->H     Read   L->H     Read   H->L 
     
        CKP: Clock Polarity Select bit (CKP == CPOL)
        1 = Idle state for clock is a high level; active state is a low level    
        0 = Idle state for clock is a low level; active state is a high level    
     
        CKE: Clock Edge Select bit (CKE == !CPHA)
        1 = Serial output data changes on transition from active clock state to idle clock state    
        0 = Serial output data changes on transition from idle clock state to active clock state    

Tuesday, February 17, 2009

Microchip I2C slave ISR calls for reading and writing

PIC24 / PIC30 / PIC32 acting as I2C slave.

If the host writes a byte to address 0x40 (0x40, data), 2 calls to the ISR occur:
(1)
  I2CxSTATbits.D_A = 0 (address)
  I2C2STATbits.R_W = 0 (write)
  I2CxRCV = 0x40 (our address)
  Don't load I2CxTRN.
(2)
  I2CxSTATbits.D_A = 1 (data)
  I2C2STATbits.R_W = 0 (write)
  I2CxRCV = incoming data
  Don't load I2CxTRN

If the host reads a byte from address 0x40, 1 call to the ISR occurs:
(1)
  I2CxSTATbits.D_A = 0 (address)
  I2C2STATbits.R_W = 1 (read)
  I2CxRCV = 0x40 (our address)
  Load I2CxTRN with response

Tuesday, November 11, 2008

Chuck Barcode



It is in Codabar format, and says "254242323434".

Thursday, August 07, 2008

Anonymous file sharing access to Vista shares

With thanks to Pete..

  • run gpedit.msc
  • local policies > user rights assignment
  • deny access to this computer from the network
  • you need to remove guest
  • then enable the guest account and set the password to blank
  • also add guest to the 'access this computer from the network' policy too
  • Tuesday, July 29, 2008

    Printer error #5 on MYOB under Vista

    Fix for a "Printer error #5" on MYOB under Vista is to reboot. If you leave it too long after rebooting, it'll get back into the 'bad' state, so start up MYOB and do that printing immediately after the reboot.

    Update: The "official" fix is to turn off UAC! http://myobaustralia.custhelp.com/app/answers/detail/a_id/13628

    Friday, July 25, 2008

    Standby!

    For all these devices:
    • microwave oven (clock)
    • three stereos (each has a clock)
    • two network switches (sitting idle)
    • projector ("off", showing orange LED)
    • VCR (clock)
    • Xbox (shutdown)
    • two LCD screens ("standby" / amber LED)
    • two computers (shutdown)
    Total power use is 93W, which is about 35 cents per day ($127/year). In other terms, one day of standby for all those devices is the same as running:
    • an airconditioner, for 45 minutes.
    • two-bar heater, for an hour.
    Other numbers:
    • Fridge, running: 140W
    • Projector, running: 130-150W
    • Stereo, running: 30-50W
    • Desktop PC (4 disk drives), running: 240W, playing games: 310W
    • Airconditioner: 3000W+
    • Pool pump: 1000W
    • Xbox, playing games: 65W
    • Laser printer, printing: 650W
    • Four 50W halogen lights, modern transformer, full power: 200W, dimmed as low as my dimmer will go: 50W
    • Six 50W halogen lights, "old" iron core transformer, full power: 300W, dimmed: 30W
    • Electric blanket, queen size: 140W

    Thursday, July 10, 2008

    Windows XP can't install or find drivers for any USB devices

    From these URLs:

    http://www.uwe-sieber.de/usbtrouble_e.html#xp_asks_for_drivers

    http://www.techspot.com/vb/showpost.php?s=80270ff40f61d379e51d250e6f86c24f&p=577370&postcount=58


    Either fix HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DevicePath to contain %SystemRoot%\inf.

    Or, when looking for the device driver, point it to "C:\Windows\inf".

    Sunday, June 15, 2008

    WGT634U open wrt notes


    CFE> flash -noheader 192.168.60.70:openwrt-wgt634u-2.6-jffs2.bin flash0.os

    setenv kernel_args "console=ttyS1,115200 root=/dev/nfs nfsroot=192.168.60.70:/openwrt init=/etc/preinit syst_size=8M"

    original: kernel_args console=ttyS1,115200 root=/dev/ram0 init=/linuxrc rw syst_size=8M
    original: STARTUP ifconfig eth0 -addr=192.168.60.60 -mask=255.255.255.0;boot -elf flash0.os:

    CFE> ifconfig eth0 -addr=192.168.60.60 -mask=255.255.255.0 -gw=192.168.60.1 -dns=192.168.60.1
    CFE> boot -elf -tftp 192.168.60.70:openwrt-wgt634u-2.6-jffs2.bin

    mount -t nfs 192.168.60.70:/openwrt /mnt -o nolock

    Friday, June 06, 2008

    Stop vista from automatically deciding which columns to show for a folder

    To make Vista not auto-detect and decide for you which columns to show for folders in explorer, you can do this:
    --- LeaveMyColumnsAlone.reg ---
    Windows Registry Editor Version 5.00

    [HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell]
    "FolderType"="NotSpecified"
    ------------------------------------