Hexadecimal number to a hardware register

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Submitted by Mala Gowda on Thu, 11/22/2012 - 19:41 

 

 

Hello:

can i please know how to write a hexadecimal number to a hardware register like 1846h, 1946h, 1A46h and 1b46h to hardware register of ADC and read the ADC channel values.

Regards, MALA

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by Mala Gowda on Fri, 11/23/2012 - 14:30.

    Can I know how to write hexadecimal number to a hardware register and read the same. For channel 1, CHSEL=1h, ACQPS=06h, TRIGSEL=09h hexadecimal number =1846h For channel 5, CHSEL=5h, ACQPS=06h, TRIGSEL=09h hexadecimal number =1946h For channel 9, CHSEL=9h, ACQPS=06h, TRIGSEL=09h hexadecimal number =1A46h For channel 13, CHSEL=Dh, ACQPS=06h, TRIGSEL=09h hexadecimal number =1B46h Extern write and read block can be configured to hardware register but how do I write a hex number. I did not find any block. Please guide me on this.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by Anders89 on Fri, 11/23/2012 - 20:30.

    VisSim supports C expressions, so you can use C notation; 0xdddd. See this post on hex number entry. To read or write a hardware register, use the externRead or externWrite* block. In the block select Hardware Register and use the register name as it appears in the TI reference guide.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    Submitted by Mala Gowda on Sat, 11/24/2012 - 10:46.

    Attached vissim diagram. i should be able to read 0.5 if voltage level is 1.65V and i read zero. why is it so. in ADC config block ADC triggering is through software, but hexadecimal number i am writing is for Timer2 triggering ADC. i want to use 2 differnt ADC Configurations. hence i am trying this. at firstpass i want Trigger ADC through Timer2 and then through ePWM's. can you give me solution for this.

    Unable to find an attachment - read this blog

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    Submitted by Anders89 on Mon, 11/26/2012 - 01:06.

    The problem is that the ADCSOCnCTL reg is EALLOW protected. You must issue an EALLOW instruction before writing to protected regs, and follow it with an EDIS instruction to re-enable protection. VisSim executes signal consumers in top down order so you put anexternFunction block that invokes EALLOW at the top, and another externFunction block that invokes EDIS at the bottom. See attached ADCnew2.vsm

    Unable to find an attachment - read this blog