Skip to main content

Messages

This section allows you to view all Messages made by this member. Note that you can only see Messages made in areas you currently have access to.

Messages - deareds

1
General discussion / How to find out the maximum frequency output from a PIC?
I used to watch a thread was dealing with maximum frequency output from a PIC for any given master clock. Unfortunately my searches did not return any good information.

I’m interested to get a small PIC device (10F or 12F type)to act as a high frequency clock generator using its internal clock and I wouldlike to know what to expect.
I have an application where the space is very tight and Ineed a modulated clock source with decent stability in the order of hundreds ofkHz but ideal will be 1MHz.
Manufacturer Part#:   
PIC12F675-I/MF
Product Category:   Embedded - Microcontrollers
Manufacturer:   Microchip Technology
Description:   IC MCU 8BIT 1.75KB FLASH 8DFNS
PIC12F675-I/MF Datasheet: http://http://www.kynix.com/uploadfiles/pdf65976/PIC12F675-I2fMF_963256.pdf
Package:   8-VDFN Exposed Pad
Quantity:   1030 PCS
Lead Free Status / RoHS Status:   Lead free / RoHS Compliant
Moisture Sensitivity Level(MSL):   3(168 Hours)
Using PBP I understand that something like:

main_loop:
Togglepin_x
GOTOmain_loop

should give maximum frequency output. Assuming that theToggle and GOTO commands will take two cycles each that will give me possibleoutput frequency of Main_clock/4/4 which will be 250 kHz for a 4MHz clock.
My question is if one uses Assembly (which is not my strongestfield) will it get any faster? Will itbe possible to make it run in the background?
Ideally I need a 1 MHz output that will be ON for 15 mS andOFF for 5 mS.

Thank you in advance for any advice.
2
General discussion / Design an amplifier which can provide 1w to a speaker
Hello!

I need help designing an amplifier that is capable of providing 1 W to an 8 Ohm speaker. I have 3.3 V, 5 V or 18 V supply available to power it.

I also have only one power supply available that has no negative output.

The signal is coming from an AVR as a 3.3 V PWM signal. I have following components available:

NPN, PNP transistors,
N-channel MOSFETs,
TL494 Pulse-Width-Modulation Control Circuit,
JRC4558, LM358 op amps,
NJM13700 TRANSCONDUCTANCE AMPLIFIER

and other standard equipment
The last three ICs I got from an old 500W amplifier (that's why I posted them here since they are useful).

I already experimented with push-pull, common emitter but just couldn't get it to work (not enough power and distortions).
Thanks to Olin Lathrop I designed a bridged class D amplifier, but its not working as it should. First off, here is the schematic:


simulate this circuit – Schematic created using CircuitLab

NOT, AND, NAND gates are all made from NAND logic gates.

NOT1 inverts the PWM signal to drive the other half of H-bridge, combined with AND3, and D6 (which is output pin on MCU), they drive the other half of the H-bridge only when D6 is high, preventing it to be on, when PWM output is low.

NAND1 prevents both halves of the H-bridge to be on at the same time (at least thats what I though it would do).

NAND1, AND1 drives one half of the H-bridge, when the PWM signal is high.

NAND1, AND2 drives second half of the H-bridge, when the PWM signal is low.

The purpose of these logic gates is also, to convert 3.3 V PWM signal to 5 V.

PROBLEM:

If I connect only one half of the H-bridge I get expected distorted sound output. Now, when I connect the second half, it makes a really bad noise and PWM signal stops.

What I think happens:

When I did some measurements with osciloscope I expected that when I would add(+) both waveforms, from AND1 and AND2, I would get a flat +5 V line, but in reality there are some spikes reaching to 0 V and 10 V on both rising and falling edges of the waveforms. So I suspect that, due to this, both of the halves of the H-bridge are on for a small amount of time, to short circuit whole thing to ground.

I am not an expert on this matter, so I would really appreciate any help from you.
3
Hardware biz / Why can't I change LEDs states using PCA9685?
Hello, I'm new here, and I want to ask for your help.

I have a PCA9685 IC connected to I2C of cubieboard like board. Also OE pin is connected to one GPIO pin. I'm using IC2tools to communicate with PCA9685, I can read/write to registers without any problems, but changes I do to registers does not take effect, LEDs don't change them state.

There are 4 RGB leds connected through a resistor to PCA9685
(as Fig 15 of PCA9685 datasheet ), this is, 12 channels are being used. Doesn't matter which value I write to PWM registers, LEDs state are always the same, oddly, colors are not equal to each LED. 1 LED has red, 1 LED has blue, 1 magenta and 1 white. However, colors are not random, always I turn off/on PCA9685 the same colors are assumed by the same LEDs.I can switch all LEDs on/off by changing OE pin state.

Here is the code I'm using to test.
Code: [Select]
#!/bin/bash

set -e

PCA9685_BUS=1
PCA9685_ADDR=0x41
PCA9685_OE="pi15"

# config GPIO as output and set initial state
${PWD}/gpio_config.sh "$PCA9685_OE" "out" "1"

# set output logic as inverted
i2cset -y $PCA9685_BUS $PCA9685_ADDR 0x01 0x10

# restart
i2cset -y $PCA9685_BUS $PCA9685_ADDR 0x00 0x91
sleep 1

# change to normal mode
i2cset -y $PCA9685_BUS $PCA9685_ADDR 0x00 0x01
sleep 1

for (( i = 0x06; i <= 0x45; i++ )); do
    i2cset -y $PCA9685_BUS $PCA9685_ADDR $i 0x0F
done

Running I2Cdump I can see registers were changed.

Code: [Select]
[root@board test]# i2cdump 1 0x41
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1, address 0x41, mode byte
Continue? [Y/n]
    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 01 10 e2 e4 e8 e0 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f    ????????????????
10: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f    ????????????????
20: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f    ????????????????
30: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f    ????????????????
40: 0f 0f 0f 0f 0f 0f XX XX XX XX XX XX XX XX XX XX    ??????XXXXXXXXXX
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
70: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
80: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
90: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
a0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
b0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
c0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
d0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
e0: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX    XXXXXXXXXXXXXXXX
f0: XX XX XX XX XX XX XX XX XX XX 00 00 00 00 1e 00    XXXXXXXXXX....?.

I've tried others values than 0x0F, same issue.
Any idea over what can be happening?