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"
    ------------------------------------

    Disable ZIP folders in Vista

    To stop ZIP files showing up in the folder tree in Explorer, the registry keys to remove are here.
    --- FixZip.reg ---
    Windows Registry Editor Version 5.00

    [-HKEY_CLASSES_ROOT\CLSID\{E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31}]
    [-HKEY_CLASSES_ROOT\CLSID\{0CD7A5C0-9F37-11CE-AE65-08002B2E1262}]
    ------------------

    Running .NET applications from a Windows fileshare.

    If you're trying to run a .NET application that's living on a remote fileshare, you need to do something like this to allow it to work:

    caspol -m -ag 1.2 -url file:w:\* FullTrust

    or

    caspol -m -ag 1.2 -url file:\\server\path\blah\* FullTrust

    caspol.exe is in the .NET SDK, installed to "C:\Windows\Microsoft .NET\Framework". I don't know if it is part of the standard .NET install. caspol.exe has to be copied locally to the machine too, it won't work from a remote share either.

    Symptoms and times this'll cause you trouble:
    - Remote debugging from one PC (XP or Vista) to another
    - Error mesage: "[Program] failed to start, application configuration is incorrect."
    - Error mesage: "Error while trying to run project: Unable to start debugging."
    - Error mesage: "Access is denied"
    - Error mesage: "
    [Program] has encountered a problem and needs to close."
    - Event log: Event ID 1000, Faulting Application.

    If you use something like dependency walker on it, and find a missing reference to a DWMAPI.DLL, then that's a red herring. That DLL is conditionally loaded, and the condition isn't met on a machine that is missing it, so its not a problem.

    Those caspol command lines are telling Windows to trust everything on that specified path, so beware!