Searching \ for '[EE] AS1107 Driver - Did I do it right?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/index.htm?key=as1107+driver+did
Search entire site for: 'AS1107 Driver - Did I do it right?'.

Exact match. Not showing close matches.
PICList Thread
'[EE] AS1107 Driver - Did I do it right?'
2009\03\04@234728 by solarwind

picon face
Ok, so I carefully read the datasheet
(http://www.austriamicrosystems.com/eng/Products/Lighting-Management/LED-Drivers/AS1107)
for the AS1107 and wrote a very simple serial driver in C (C18
compiler).

Can someone please tell me if I am doing this correctly? My code his here:

http://pastebin.com/f244a02f3

If someone could check my code, I would greatly appreciate it. Thanks!

--
solarwind

2009\03\05@012613 by Rikard Bosnjakovic

picon face
On Thu, Mar 5, 2009 at 05:47, solarwind <spam_OUTx.solarwind.xTakeThisOuTspamgmail.com> wrote:

> Can someone please tell me if I am doing this correctly? My code his here:
> http://pastebin.com/f244a02f3

Looks okay to me, even if the code is not complete.

Here's another example that I wrote for testing a digital
potentiometer using SPI. Perhaps you can steal some of it:


__CONFIG(UNPROTECT & LVPDIS & BORDIS & MCLREN & WDTDIS & PWRTDIS & INTIO);

void delay() {
   int delayer = 10;
   while (delayer != 0) {
       delayer -= 1;
   }

   return;
}

void spi_write(unsigned char data) {
  unsigned char i, j;
   for (i = 1; i < 9; i++) {
       RB2 = 0;
       j = 1 << (8-i);                         // MSB first
       if (data & j)
           RB2 = 1;                            // If data, pulse data line
       RB1 = 1;                                // Pulse clock
       RB1 = 0;
   }
}

void main() {
   unsigned char resistance = 0, op = 0;
   OPTION = 0;
   VRCON = 0;
   EECON1 = 0;
   TRISA = 0;
   TRISB = 0;
   CMCON = 0x7;
   INTCON = 0;
   PORTA = 0;
   PORTB = 0;

   // Neverending loop
   // RB0: Chip select (active low)
   // RB1: SPI-clock
   // RB2: SPI-data
   while (1) {
       RB0 = 0;                                // Make digipot active
       spi_write(0b00001001);                  // Write data / All pots
       spi_write(resistance);                  // Update the resistance
       RB0 = 1;                                // Disable pot

       if (resistance > 127)
           op = 1;
       else if (resistance == 0)
           op = 0;

       if (op)
           resistance -= 1;
       else
           resistance += 1;
   }
}

What it does is to send the values 0..127 (back and forth) to the
digipot while I measured it using a DMM. It was run on a low clocked
PIC (32kHz I think), and that's why I don't use any delay-routines for
the strobing.


--
- Rikard - http://bos.hack.org/cv/

2009\03\05@014157 by solarwind

picon face
On Thu, Mar 5, 2009 at 6:25 AM, Rikard Bosnjakovic
<.....rikard.bosnjakovicKILLspamspam@spam@gmail.com> wrote:
{Quote hidden}

Thanks for posting. My code is pretty much the same as yours. However,
it seems that your chip does things a bit differently. According to
the data sheet of my chip (I may be interpreting it wrong, however),
the chip select line acts like a latch and should be strobed after 16
bits have been clocked in. So I send in 16 bits one by one and latch
the data. I made my circuit and tested, but nothing is working. I
tested the voltage across the digit pins of the chip but it's at 0 V,
so I think the problem for me lies in my serial data transmission code
or the format in which I am sending it...


--
solarwind

2009\03\05@075718 by Michael Rigby-Jones

picon face


> -----Original Message-----
> From: .....piclist-bouncesKILLspamspam.....mit.edu [EraseMEpiclist-bouncesspam_OUTspamTakeThisOuTmit.edu] On
Behalf
{Quote hidden}

According to the datasheet you posted a link to you have interpreted
this incorrectly.  Check out the timing diagram on page 8, this is a
typical SPI peripheral that requires a chip select to be pulled low
before clocking data in, and the entire data word is internally latched
on the rising edge of the chip select.

Also why the 100us delays?  The device can accept a minimum clock period
of 100ns, you are massively slowing down the bus speed here.  Also why
are you bit-bashing the SPI?  Does the 18F part you are using not have
an MSSP unit?

Regards

Mike.

=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================

2009\03\05@080340 by Rikard Bosnjakovic

picon face
On Thu, Mar 5, 2009 at 07:41, solarwind <x.solarwind.xspamspam_OUTgmail.com> wrote:

> Thanks for posting. My code is pretty much the same as yours. However,
> it seems that your chip does things a bit differently. According to
> the data sheet of my chip (I may be interpreting it wrong, however),
> the chip select line acts like a latch and should be strobed after 16
> bits have been clocked in. So I send in 16 bits one by one and latch
> the data. I made my circuit and tested, but nothing is working. I
> tested the voltage across the digit pins of the chip but it's at 0 V,
> so I think the problem for me lies in my serial data transmission code
> or the format in which I am sending it...

According to the timing table on page 8, the load-line should go from
high to low prior to strobing your 16bit-data, and immediately after
brought to high again, which is what you are doing according to your
code. Perhaps you are sending the wrong address data?

Are your LED-segments powered and working? Is the AS-chip powered?


--
- Rikard - http://bos.hack.org/cv/

2009\03\05@152736 by solarwind

picon face
On Thu, Mar 5, 2009 at 1:03 PM, Rikard Bosnjakovic
<@spam@rikard.bosnjakovicKILLspamspamgmail.com> wrote:
> According to the timing table on page 8, the load-line should go from
> high to low prior to strobing your 16bit-data, and immediately after
> brought to high again, which is what you are doing according to your
> code. Perhaps you are sending the wrong address data?

I think the address data is fine. I think.

> Are your LED-segments powered and working? Is the AS-chip powered?

Yes, the LEDs are working, I had to map the pins on the matrix module
myself before wiring up the chip. Yes, the chip has power, I measured
the voltage across both the ground pins and the V+ pin.

This is why I need example code to see this in action.

And yes, I have an SPI module on my PIC but the pins are being used
for something else and it will be too much trouble to rearrange.
Besides, this code should work fine, but it's not.


--
solarwind

2009\03\05@162630 by cdb

flavicon
face


:: This is why I need example code to see this in action

Have you checked out the code for the Maxim part on their website?

From a quick (and I do mean quick skim) doesn't the chip wake up in
blanking mode and you have to 'wake' it up?

I take it 'nothing is working' means the LEDs are not lighting up. You
haven't by any chance attached or wired CC tpyes when you need CA
types?

Colin
--
cdb, KILLspamcolinKILLspamspambtech-online.co.uk on 6/03/2009

Web presence: http://www.btech-online.co.uk  

Hosted by:  http://www.1and1.co.uk/?k_id=7988359

D





2009\03\05@165059 by solarwind

picon face
On Thu, Mar 5, 2009 at 9:26 PM, cdb <RemoveMEcolinTakeThisOuTspambtech-online.co.uk> wrote:
> Have you checked out the code for the Maxim part on their website?

Nope. No idea what you're talking about.

>  From a quick (and I do mean quick skim) doesn't the chip wake up in
> blanking mode and you have to 'wake' it up?

I DID wake it up! See my code. I'll post a revised version.

> I take it 'nothing is working' means the LEDs are not lighting up. You
> haven't by any chance attached or wired CC tpyes when you need CA
> types?

It's an LED matrix... I tested them myself because the modules I
bought didn't come with a pinout sheet so I had to sit and test all
the pins for the rows and columns. All the LEDs work fine. I hooked it
up right. Besides, I'm not getting any voltage across the digit pins
on the AS1107 itself.

2009\03\05@165255 by solarwind

picon face
Ok, here's my code:

main.c - http://pastebin.com/f7b92077d
AS1107_driver.c - http://pastebin.com/f3b95aa50
AS1107_driver.h - http://pastebin.com/f6b52b812

Please view.

2009\03\05@224236 by andrew kelley

picon face
Chip-Select Input (AS1107 or AS1106 SPI-enabled only). Serial data is
loaded into the shift register while this pin is low. The last 16 bits of serial
data are latched on the rising edge of this pin.

http://pastebin.com/m5d4a2d1

On Thu, Mar 5, 2009 at 4:52 PM, solarwind <spamBeGonex.solarwind.xspamBeGonespamgmail.com> wrote:
> Ok, here's my code:
>
> main.c - http://pastebin.com/f7b92077d
> AS1107_driver.c - http://pastebin.com/f3b95aa50
> AS1107_driver.h - http://pastebin.com/f6b52b812
>
> Please view.
> -

2009\03\05@232413 by solarwind

picon face
On Thu, Mar 5, 2009 at 10:42 PM, andrew kelley <TakeThisOuTleetslackerEraseMEspamspam_OUTgmail.com> wrote:
> Chip-Select Input (AS1107 or AS1106 SPI-enabled only). Serial data is
> loaded into the shift register while this pin is low. The last 16 bits of serial
> data are latched on the rising edge of this pin.
>
> http://pastebin.com/m5d4a2d1

Thank you for your reply, but this had no effect what so ever. Isn't
it the same thing as my code except you're holding the chip-select
high for a much longer time?

2009\03\06@000250 by cdb

flavicon
face


:: Thank you for your reply, but this had no effect what so ever.
:: Isn't
:: it the same thing as my code except you're holding the chip-select
:: high for a much longer time?

Are you getting any voltage change levels at the Pic pins? If not,
disconnect the As1107, slow your code right down to 0.5 - 1 second and
make sure your pins are doing what you think they should be doing.

If they are, then reconnect the AS1107 and make sure the same sequence
is still occurring - if the sequence stops, then head scratching
around your AS1107 is in order - perhaps it's cactus!

Colin
--
cdb, RemoveMEcolinspamTakeThisOuTbtech-online.co.uk on 6/03/2009

Web presence: http://www.btech-online.co.uk  

Hosted by:  http://www.1and1.co.uk/?k_id=7988359







2009\03\06@002723 by solarwind

picon face
On Fri, Mar 6, 2009 at 12:01 AM, cdb <colinEraseMEspam.....btech-online.co.uk> wrote:
> Are you getting any voltage change levels at the Pic pins? If not,
> disconnect the As1107, slow your code right down to 0.5 - 1 second and
> make sure your pins are doing what you think they should be doing.

Yes, the PIC pins are working fine - I hooked up LEDs at the unused
PORTC pins and they are working fine.

> If they are, then reconnect the AS1107 and make sure the same sequence
> is still occurring - if the sequence stops, then head scratching
> around your AS1107 is in order - perhaps it's cactus!

2009\03\06@032927 by solarwind

picon face
I think the problem is in the sending of the data. I think...

I will probably need to build myself a logic analyzer to make sure
everything's running properly. I know someone recommended me this
chip, and they have used it before. Whoever you are, if you could
please send me some test code, I would really appreciate it.

2009\03\06@033648 by solarwind

picon face
Found him. Sent him an email:


---------------------------------------------------------------------------------------------------------



On Tue, Feb 24, 2009 at 10:00 PM, Matt Pobursky <EraseMEpiclistspammps-design.com> wrote:
{Quote hidden}

Hi Matt, thanks for recommending the Austriamicrosystems chips. My
samples of AS1107 arrived earlier this week and I'm having trouble
driving them with my PIC microcontroller via SPI. The AS1108 seems to
be a very similar chip, with less outputs.

Could you please send me the code you use to drive your AS1108 chip?
(Or the code that you use to drive the AS1107, if you use those). Any
code at all will help a lot.

Thanks in advance!

2009\03\06@044600 by Rikard Bosnjakovic

picon face
On Fri, Mar 6, 2009 at 09:29, solarwind <RemoveMEx.solarwind.xEraseMEspamEraseMEgmail.com> wrote:

> I will probably need to build myself a logic analyzer to make sure
> everything's running properly. I know someone recommended me this
> chip, and they have used it before. Whoever you are, if you could
> please send me some test code, I would really appreciate it.

I have a couple of hours off today so I might as well dig into this.

1. Make a schematic of your circuit and post it
2. Post the full source code - without hiding used functions in
separate files - of what you are doing that won't make the LEDs light
up

Note to 2: Your code at http://pastebin.com/f244a02f3 is meaningless
since latch() is the only function called and send_data() never used
(although defined). That's not a good source code.


--
- Rikard - http://bos.hack.org/cv/

More... (looser matching)
- Last day of these posts
- In 2009 , 2010 only
- Today
- New search...