CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Max speed SPI Software 16f628
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Jul 12, 2021 10:08 am     Reply with quote

You seem to be talking now about two modules, not 15. A very different
amount of data involved.
vtrx



Joined: 11 Oct 2017
Posts: 141

View user's profile Send private message

PostPosted: Mon Jul 12, 2021 3:56 pm     Reply with quote

Code:
// MATRIZ 8X8 MAX7912
#include<16F628a.H>

#device PASS_STRINGS = IN_RAM
#include "Font8x8_original.h"
#include <string.h>

#fuses NOWDT                    //No Watch Dog Timer
//#fuses INTRC                    //Internal RC Osc
#fuses HS
#fuses NOPUT                    //No Power Up Timer
#fuses NOPROTECT                //Code not protected from reading
#fuses NOBROWNOUT               //No brownout reset
#fuses NOMCLR                   //Master Clear pin used for I/O
#fuses NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#fuses NOCPD                    //No EE protection

#use fast_io(a)
#use fast_io(b)

//#use delay(clock=4000000)
#use delay(clock=20000000)

#use rs232 (baud=9600,rcv=PIN_B1,xmit=PIN_B2,parity=N,bits=8)
#use SPI(DO=PIN_A0,DI=PIN_A3,CLK=PIN_A2,MODE=0,BAUD =270000,BITS=16,msb_first,SAMPLE_RISE,STREAM = max7912)

#define CS           PIN_A1

typedef enum
   {
   REG_NO_OP         = 0x0000,
   REG_DIGIT_0       = 0x01 << 8,
   REG_DIGIT_1       = 0x02 << 8,
   REG_DIGIT_2       = 0x03 << 8,
   REG_DIGIT_3       = 0x04 << 8,
   REG_DIGIT_4       = 0x05 << 8,
   REG_DIGIT_5       = 0x06 << 8,
   REG_DIGIT_6       = 0x07 << 8,
   REG_DIGIT_7       = 0x08 << 8,
   REG_DECODE_MODE   = 0x09 << 8,
   REG_INTENSITY     = 0x0A << 8,
   REG_SCAN_LIMIT    = 0x0B << 8,
   REG_SHUTDOWN      = 0x0C << 8,
   REG_DISPLAY_TEST  = 0x0F << 8,
 } MAX7219_REGISTERS;

boolean completo;
char              texto[15];
unsigned int16    txt0,txt1,txt2,txt3,txt4,txt5,txt6,txt7,txt8,txt9,txt10,txt11,txt12,txt13,txt14;
int8              posi_rs232;

void sendData(int16 data);
void max7219_clean(int8 MaxCi);
//void MAX_SendString(char *str);
void MAX_SendString();
void escreve_texto(void);
void max7219_init(unsigned int8 intensivity,unsigned int8 Modulos);

//-------------------------------------------------------------
#int_rda
void rda_isr(void)
{
 texto[posi_rs232] = getc();
 posi_rs232++;
 if(posi_rs232==15)     //15 max7912
  {
   posi_rs232 = 0;
   completo = 1;
  }
}
//------------------------------------------------------------------
void sendData(unsigned int16 data)
{
  spi_xfer(max7912,data);
  output_low(CS);
  output_high(CS);
}
//---------------------------------------------------------------
void max7219_clean(unsigned int8 MaxCi)
{
   int16 Mods;
   
   for(Mods=0;Mods<MaxCi-1;Mods++){spi_xfer(max7912,REG_NO_OP);}   //SEMPRE -1 QUANTIDADE DE MODULOS
   for(Mods=0;Mods<MaxCi;Mods++)
   {
   sendData(REG_DIGIT_0 | 0x00);
   sendData(REG_DIGIT_1 | 0x00);
   sendData(REG_DIGIT_2 | 0x00);
   sendData(REG_DIGIT_3 | 0x00);
   sendData(REG_DIGIT_4 | 0x00);
   sendData(REG_DIGIT_5 | 0x00);
   sendData(REG_DIGIT_6 | 0x00);
   sendData(REG_DIGIT_7 | 0x00);
   }     
}
/*
//---------------------------------------------------------------
void MAX_SendString(char *str)
{
     int8 i=0;
     
     while(*str)
     {
         texto[i++]=*(str++);
         if (i == 15) break;
     }     
     txt0=(int16)(texto[0]-32)*8;
     txt1=(int16)(texto[1]-32)*8;
     txt2=(int16)(texto[2]-32)*8;
     txt3=(int16)(texto[3]-32)*8;
     txt4=(int16)(texto[4]-32)*8;
     txt5=(int16)(texto[5]-32)*8;
     txt6=(int16)(texto[6]-32)*8;
     txt7=(int16)(texto[7]-32)*8;
     txt8=(int16)(texto[8]-32)*8;
     txt9=(int16)(texto[9]-32)*8;
     txt10=(int16)(texto[10]-32)*8;
     txt11=(int16)(texto[11]-32)*8;
     txt12=(int16)(texto[12]-32)*8;
     txt13=(int16)(texto[13]-32)*8;
     txt14=(int16)(texto[14]-32)*8;
}
//--------------------------------------------------------------------
*/
//---------------------------------------------------------------
void MAX_SendString()
{     
     txt0=(int16)(texto[0]-32)*8;
     txt1=(int16)(texto[1]-32)*8;
     txt2=(int16)(texto[2]-32)*8;
     txt3=(int16)(texto[3]-32)*8;
     txt4=(int16)(texto[4]-32)*8;
     txt5=(int16)(texto[5]-32)*8;
     txt6=(int16)(texto[6]-32)*8;
     txt7=(int16)(texto[7]-32)*8;
     txt8=(int16)(texto[8]-32)*8;
     txt9=(int16)(texto[9]-32)*8;
     txt10=(int16)(texto[10]-32)*8;
     txt11=(int16)(texto[11]-32)*8;
     txt12=(int16)(texto[12]-32)*8;
     txt13=(int16)(texto[13]-32)*8;
     txt14=(int16)(texto[14]-32)*8;
}
//--------------------------------------------------------------------
void escreve_texto(void)
{
unsigned int16 lop2;

    for(lop2=0;lop2 < 8;lop2++)
        {   
         spi_xfer(max7912,REG_NO_OP);
         spi_xfer(max7912,REG_NO_OP);
         spi_xfer(max7912,REG_NO_OP);
         spi_xfer(max7912,REG_NO_OP);
         spi_xfer(max7912,REG_NO_OP);
         spi_xfer(max7912,REG_NO_OP);
         spi_xfer(max7912,REG_NO_OP);
         spi_xfer(max7912,REG_NO_OP);
         spi_xfer(max7912,REG_NO_OP);
         spi_xfer(max7912,REG_NO_OP);
         spi_xfer(max7912,REG_NO_OP);
         spi_xfer(max7912,REG_NO_OP);
         spi_xfer(max7912,REG_NO_OP);
         spi_xfer(max7912,REG_NO_OP);


         sendData((8-lop2) << 8|font8x8_basic[(txt14+lop2)]);
         sendData((8-lop2) << 8|font8x8_basic[(txt13+lop2)]);       
         sendData((8-lop2) << 8|font8x8_basic[(txt12+lop2)]);         
         sendData((8-lop2) << 8|font8x8_basic[(txt11+lop2)]);       
         sendData((8-lop2) << 8|font8x8_basic[(txt10+lop2)]);       
         sendData((8-lop2) << 8|font8x8_basic[(txt9+lop2)]);       
         sendData((8-lop2) << 8|font8x8_basic[(txt8+lop2)]);       
         sendData((8-lop2) << 8|font8x8_basic[(txt7+lop2)]);       
         sendData((8-lop2) << 8|font8x8_basic[(txt6+lop2)]);       
         sendData((8-lop2) << 8|font8x8_basic[(txt5+lop2)]);       
         sendData((8-lop2) << 8|font8x8_basic[(txt4+lop2)]);       
         sendData((8-lop2) << 8|font8x8_basic[(txt3+lop2)]);       
         sendData((8-lop2) << 8|font8x8_basic[(txt2+lop2)]);       
         sendData((8-lop2) << 8|font8x8_basic[(txt1+lop2)]);       
         sendData((8-lop2) << 8|font8x8_basic[(txt0+lop2)]);
        }
}
//----------------------------------------------------------------------------
void max7219_init(unsigned int8 intensivity,unsigned int8 Modulos)
{
   int16 lp;
   for(lp=0;lp<Modulos-1;lp++){spi_xfer(max7912,REG_NO_OP);}   //SEMPRE QUANTIDADE DE MÓDULOS - 1
   for(lp=0;lp<Modulos;lp++)   
   {
   if (intensivity > 0x0F)
      return;
   sendData(REG_DECODE_MODE | 0x00); 
   sendData(REG_INTENSITY | intensivity);
   sendData(REG_SCAN_LIMIT | 0x07);
   sendData(REG_DISPLAY_TEST | 0x00);
   sendData(REG_SHUTDOWN | 0x01);
  }
   max7219_clean(Modulos);
}

//-------------------------------------------------------------
void main()
{
 set_tris_a(0b00000000);
 set_tris_b(0b00000010);
 setup_comparator(NC_NC_NC_NC);
 setup_vref(FALSE);
 enable_interrupts(int_rda);
 enable_interrupts(GLOBAL);
 output_high(CS);
 max7219_init(0,15) ;
 posi_rs232 = 0;
 completo = 0;
 
 texto[0] = '.';
 texto[1] = '.';
 texto[2] = 'M';
 texto[3] = 'a';
 texto[4] = 't';
 texto[5] = 'r';
 texto[6] = 'i';
 texto[7] = 'x';
 texto[8] = ' ';
 texto[9] = 'L';
 texto[10] = 'e';
 texto[11] = 'd';
 texto[12] = 's';
 texto[13] = '.';
 texto[14] = '.';
 MAX_SendString();
 escreve_texto();
   
   // TESTE  init//
/*   
  MAX_SendString("..Matrix Leds..");
  escreve_texto();
*/
 while(true)
  {
   delay_ms(100);
   if(completo==1)
    {
     MAX_SendString();
     escreve_texto();
     completo = 0;
     posi_rs232 = 0;
    }

  }
}
//.........


Font8x8_original.h:

Code:
unsigned char const font8x8_basic[] =
 {
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,   // U+0020 (space)      0   (32 decimal ascii)
     0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00,   // U+0021 (!)          8
     0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,   // U+0022 (")          24
     0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00,   // U+0023 (#)          32
     0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00,   // U+0024 ($)          40
     0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00,   // U+0025 (%)          48
     0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00,   // U+0026 (&)          56
     0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,   // U+0027 (')          64
     0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00,   // U+0028 (()          72
     0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00,   // U+0029 ())          80
     0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00,   // U+002A (*)          88
     0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00,   // U+002B (+)          96
     0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06,   // U+002C (,)          104
     0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00,   // U+002D (-)          112
     0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00,   // U+002E (.)          120
     0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00,   // U+002F (/)          128
     0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00,   // U+0030 (0)          136
     0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00,   // U+0031 (1)          144
     0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00,   // U+0032 (2)          152
     0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00,   // U+0033 (3)          160
     0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00,   // U+0034 (4)          168
     0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00,   // U+0035 (5)          176
     0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00,   // U+0036 (6)          184
     0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00,   // U+0037 (7)          192
     0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00,   // U+0038 (8)          200
     0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00,   // U+0039 (9)          208
     0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00,   // U+003A (:)          216
     0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06,   // U+003B (;)          224
     0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00,   // U+003C (<)          232
     0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00,   // U+003D (=)          240
     0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00,   // U+003E (>)          248
     0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00,   // U+003F (?)          256
     0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00,   // U+0040 (@)          264
     0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00,   // U+0041 (A)          272
     0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00,   // U+0042 (B)          280
     0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00,   // U+0043 (C)          288
     0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00,   // U+0044 (D)          296
     0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00,   // U+0045 (E)          304
     0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00,   // U+0046 (F)          312
     0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00,   // U+0047 (G)          320
     0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00,   // U+0048 (H)          328
     0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00,   // U+0049 (I)          336
     0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00,   // U+004A (J)          344
     0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00,   // U+004B (K)          352
     0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00,   // U+004C (L)          360
     0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00,   // U+004D (M)          368
     0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00,   // U+004E (N)          376
     0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00,   // U+004F (O)          384
     0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00,   // U+0050 (P)          392
     0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00,   // U+0051 (Q)          400
     0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00,   // U+0052 (R)          408
     0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00,   // U+0053 (S)          416
     0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00,   // U+0054 (T)          424
     0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00,   // U+0055 (U)          432
     0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00,   // U+0056 (V)          440
     0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00,   // U+0057 (W)          448
     0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00,   // U+0058 (X)          456
     0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00,   // U+0059 (Y)          464
     0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00,   // U+005A (Z)          472
     0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00,   // U+005B ([)          480
     0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00,   // U+005C (\)          488
     0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00,   // U+005D (])          496
     0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00,   // U+005E (^)          504
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,   // U+005F (_)          512
     0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,   // U+0060 (`)          520
     0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00,   // U+0061 (a)          528
     0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00,   // U+0062 (b)          536
     0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00,   // U+0063 (c)          544
     0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00,   // U+0064 (d)          552
     0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00,   // U+0065 (e)          560
     0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00,   // U+0066 (f)          568
     0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F,   // U+0067 (g)          576
     0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00,   // U+0068 (h)          584
     0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00,   // U+0069 (i)          592
     0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E,   // U+006A (j)          600
     0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00,   // U+006B (k)          608
     0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00,   // U+006C (l)          616
     0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00,   // U+006D (m)          624
     0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00,   // U+006E (n)          632
     0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00,   // U+006F (o)          640
     0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F,   // U+0070 (p)          648
     0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78,   // U+0071 (q)          656
     0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00,   // U+0072 (r)          664
     0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00,   // U+0073 (s)          672
     0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00,   // U+0074 (t)          680
     0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00,   // U+0075 (u)          688
     0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00,   // U+0076 (v)          696
     0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00,   // U+0077 (w)          704
     0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00,   // U+0078 (x)          712
     0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F,   // U+0079 (y)          720
     0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00,   // U+007A (z)          728
     0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00,   // U+007B ({)          736
     0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00,   // U+007C (|)          744
     0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00,   // U+007D (})          752
     0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,   // U+007E (~)          760
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00    // U+007F              768
};

/**
 * 8x8 monochrome bitmap fonts for rendering
 * Author: Daniel Hepper <daniel@hepper.net>
 *
 * License: Public Domain
 *
 * Based on:
 * // Summary: font8x8.h
 * // 8x8 monochrome bitmap fonts for rendering
 * //
 * // Author:
 * //     Marcel Sondaar
 * //     International Business Machines (public domain VGA fonts)
 * //
 * // License:
 * //     Public Domain
 *
 * Fetched from: http://dimensionalrift.homelinux.net/combuster/mos3/?p=viewsource&file=/modules/gfx/font8_8.asm
 **/

// Constant: font8x8_basic
// Contains an 8x8 font map for unicode points U+0000 - U+007F (basic latin)


I couldn't do the simulation in Proteus, the letters are not displayed as they should.
To test the hardware
modules start from left to right.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jul 12, 2021 4:48 pm     Reply with quote

vtrx wrote:

void sendData(unsigned int16 data)
{
spi_xfer(max7912,data);
output_low(CS);
output_high(CS);
}

Does this work ?
vtrx



Joined: 11 Oct 2017
Posts: 141

View user's profile Send private message

PostPosted: Mon Jul 12, 2021 4:55 pm     Reply with quote

This code is fully functional.
In fact only the MAX7221 would need to use:

Code:
 
output_low(CS);
spi_xfer(max7912,data);
output_high(CS);
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jul 12, 2021 5:22 pm     Reply with quote

The data sheet shows it being used in the typical gated mode.
If it works with that routine, it means only the latching function
of the rising edge of \CS is used.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jul 12, 2021 5:31 pm     Reply with quote

just a comment.

I think the '7912' numbers in your program are really supposed to be '7219' .
A '7912' to me is a -12V voltage regulator(yeah, I'm that old....)
the 7219 is a MAXIM part, 8by8 LED chip.

also

You need to add 'errors' to the USE RS232(...options....) otherwise the HW UART will 'lockup/freeze' due to overrun conditions when more than 2-3 characters are sent to it and the program hasn't read them.

Jay
vtrx



Joined: 11 Oct 2017
Posts: 141

View user's profile Send private message

PostPosted: Mon Jul 12, 2021 7:36 pm     Reply with quote

temtronic wrote:
just a comment.

I think the '7912' numbers in your program are really supposed to be '7219' .
A '7912' to me is a -12V voltage regulator(yeah, I'm that old....)
the 7219 is a MAXIM part, 8by8 LED chip.

also

You need to add 'errors' to the USE RS232(...options....) otherwise the HW UART will 'lockup/freeze' due to overrun conditions when more than 2-3 characters are sent to it and the program hasn't read them.

Jay


You are right!
I think I thought a lot about the code and that's why I got confused.
Type 7912 on Google and it will show 7219...
I'm not alone!

http://jdimeglio.blogspot.com/2014/05/max7912-and-pic18f.html
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue Jul 13, 2021 1:18 am     Reply with quote

As shown, 2 modules, not '15'.
Understand each chip here drives up to 8 digits. 15 chips (modules), would
drive up to 120 digits.
You seem to be referring to the 'digits', as 'modules'. Sad
With only two chips, the amount of data involved, drops by nearly 8*.
Very much easier to handle, and fitting comfortably in the smaller PIC.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jul 13, 2021 7:43 am     Reply with quote

whew.... it could be due to English not being the easiest lanuguage to understand. Heck, I'm almost a 70 year old Canadian, and I STILL have problems with it..... Sometimes several words can mean the same thing,

yes, 2 MAX7219 chips control 16 , seven segment displays.
well really 8 segments, the decicmal point should be considered a 'segment'.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group