Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

PIC enhanced Mid-Range core and 16F1826.

2 posters

Go to page : Previous  1, 2, 3  Next

Go down  Message [Page 2 of 3]

MSABU



And here is the peripherals file with the pull up control and Digital/Analog selection registers added as Configreg to their respective port.
Code:

<parts>
    <port name="PORTA" pins="8" outreg="PORTA" dirreg="!TRISA" configregsA="ANSELA" configregsB="WPUA"
          inpmask="11011111" opencol="00000000"
          clockpins="PORTA6,PORTA7" resetpin="PORTA5">
    </port>
   
    <port name="PORTB" pins="8" outreg="PORTB" dirreg="!TRISB" configregsA="ANSELB" configregsB="WPUB" >
        <interrupt name="PB_INT" mask="11111111"/>
        <extint    name="INT" pin="PORTB0" configbits="INTEDG"/>
    </port>
   
    <timer name="TIMER0" counter="TMR0" configregsA="OPTION">
        <prescaler values="2,4,8,16,32,64,128,256"/>
        <extclock type="PIN" source="PORTA4"/>
        <interrupt name="T0_OVF" />
    </timer>
   
    <timer name="TIMER1" counter="TMR1L,TMR1H" configregsA="T1CON">
        <prescaler values="1,2,4,8"/>
        <extclock type="PIN" source="PORTB6"/>
        <interrupt name="T1_OVF" />
    </timer>
   
    <timer name="TIMER2" counter="TMR2" configregsA="T2CON" configregsB="PR2">
        <prescaler values="1,4,16,64"/>
        <interrupt name="T2_MATCH" />
    </timer> 
   
    <ccpunit name="ECCP1" type="01" pin="PORTB3" ccpreg="CCPR1L,CCPR1H" configregsA="CCP1CON">
        <interrupt name="CCP1" />
    </ccpunit>
   
    <usart name="EUSART"  number="1" configregsA="TXSTA" configregsB="RCSTA" configregsC="BAUDCON">
        <trunit type="tx" pin="PORTB2,PORTB5" configbits="RXDTSEL" register="TXREG">
        </trunit>
       
        <trunit type="rx" pin="PORTB1,PORTB2" configbits="TXCKSEL" register="RCREG">
            <interrupt name="USART_R" />
        </trunit>
        <interrupt name="USART_T" />
    </usart>
   
    <vref name="Vref" configregsA="ADCON1" pinout="PORTA2,PORTA3">
    </vref>
   
    <acomp name="COMP01" configregsA="CM1CON0" configregsB="CM1CON1" pins="PORTA0,PORTA3,PORTA2">
        <interrupt name="ACOMP" />
    </acomp>
   
    <acomp name="COMP02" configregsA="CM2CON0" configregsB="CM2CON1" pins="PORTA1,PORTA2,PORTA4">
        <interrupt name="ACOMP" />
    </acomp>
   
    <wdt name="WatchDog" configregsA="WDTCON">
        <prescaler select="" values="32,64,128,256,512,1024,2048,4096,8192,16384,32768,6553,131072,262144,524288,1048576,2097152,4194304,8388608"/>
    </wdt>
</parts>

arcachofo

arcachofo

I have updated your p16F182x_regs.xml (791) file with the reset register values.
However I do not know what needs to go in masks and I did not know what to write for the undefined Reset value per thereunder :
x = unknown, u = unchanged, q = value depends on condition, - = unimplemented
Here is the file content :
That's great.
By now undefined reset values are set to 0, to see the values that the firmware is actually Writting.
Different types of restes  are not yet implemented as well, any reset is considered a hard reset.
This will be implemented in the future, so it's good to have the information already there.

Here is the register file with most of the mask values updated.
Nice, I will updatethe file.

And here is the peripherals file with the pull up control and Digital/Analog selection registers added as Configreg to their respective port.
Ok, I will implement pullups and analog pins.
Next I will do Eusart.
I already did ADC basic implementation.

Then I will upload executables and we can start testing these periferical and the core itself.
By now everything is roughly implemented and there are a few things I'm not sure how to implement.
For example the issue with PORT and LAT registers.

MSABU



OK I'll let you move ahead. Let me know if you need more from me.

arcachofo

arcachofo

OK I'll let you move ahead. Let me know if you need more from me.
There are plenty of things to do, all depends on how much available time you have.

When I upload excutables with las changes, these perifericals already implemented must be tested.
Something that is very time consuming is creating circuits and firmwares to test each functionality.
So we will need test units for:

PORT test:
- Basic IO.
- Pullups.
- Interrupts.
- PORTA5 is only input.
- Analog Pins.
All these could be done in just one circuit and fimware?

ADC test:
- Basic case: read one ADC channel with default configuration.
- Value right/left alignment.
- Vref. different configurations (this has still some limitations because internal Vref is not yet implemented).

Eusart test:
- Basic test: Serial monitor working, Serial echo.
- Basic communication betwen 2 p16f1826.

But take it easy... by now let me finish basic implementation for these perifericals.

MSABU



I do know by now not to jump ahead too fast, I will wait for your signal.
I am OK to take care of :
Arcachofo wrote:PORT test:
- Basic IO.
- Pullups.
- Interrupts.
- PORTA5 is only input.

Eusart test:
- Basic test: Serial monitor working, Serial echo.
- Basic communication betwen 2 p16f1826.

Never worked much with ADCs or analog but could look into it if needed.

arcachofo

arcachofo

I do know by now not to jump ahead too fast, I will wait for your signal.
You are right, and we are going little bit fast..

Never worked much with ADCs or analog but could look into it if needed.
Ok, don't worry about this, I will take care of ADC.

MSABU



Report Back Linux64-V802 :
Compilation :
Build folder creates properly.
GCB returns :
Program assembled successfully
SUCCESS!!! Compilation OK
But hex file is not present in the build folder.
Testing with GCB IDE :
- RA5 shows as IN/OUT (double Arrow) not as IN only
Pull-Ups :
-Functional on A5
-Functional on Port B. Turning it ON/OFF with either WPUB=0 or 255
-Functional Individually. WPUBx=0/1 maintains RBx low/high
USART :
Setting SerInPort RB1 and SerOutPort RB2 shows properly on animate.
However when opening serial monitor :
HSerPrint RA0 outputs properly the pin state
but
HSerPrint "16F1826" prints nothing on monitor
PORTS IO :
Not Functional individually RBx or RAx =1 does not turn the PIN ON.
but PORTA=255 or 0 works

Will continue testing but if you could fix the compilation issue it would help a lot.

arcachofo

arcachofo

Nice I will have a look at those issues.

if you could fix the compilation issue it would help a lot.
In this version the compilation issues are mostly solvable editing the compiler file or setting the proper toolpath:

Most probably you need to set Gcbasic path:
- Click on the gear on top of the editor window.
- Select "Compiler Settings"
- Add the path to gcbasic in "Tool Path" field (path to the folder containing Gacbasic executable).
   Example: /home/user/GreatCowBasic/

arcachofo

arcachofo

I found a problem with hex files generated by Gcbasic for these devices:
It's using Extended Linear Address, which is not implemented.
So in simulide part of the flash memory is overwritten, leading to undefined behabior.
I will implement it at upload new executable later today.
Without this it's imposible to run firmware generated by Gcbasic.

Gcbasic also decided that PORTB.0 = 1 must be compiled as: bsf LATB,0 instead of bsf PORTB,0
And as mentioned before writting to LATx is not yet implemented.
So I will try to solve this issue as well.

EDIT: the problem with Gcbasic is that it does more than you tell it to do...

MSABU



Makes sense now because when moving code around, things would work and then break if I moved the lines to another spot.
I would have done a bsf PORT as well but they must have their reasons to go LAT ??

arcachofo

arcachofo

@MSABU:
Didn't know you are using Linux.
How do you feel about compiling simulide?

MSABU



Sure happy to compile. I could check out the source but not sure that I would be of much help.

arcachofo

arcachofo

Sure happy to compile. I could check out the source but not sure that I would be of much help.
The idea is that you could compile the last changes in the repository.
This way you would not need to wait for the next build to be uploaded.

For example, now the LAT/PORT issue is solved in the repo, also the "Executable not found" issue.
If you get everything setup to compile simulide, and sinchronize with lauchpad, then you could get last fixes right after I do the commit.

MSABU



Forget my earlier comment on GCbasic compilation.
I have synched the 819 branch using
bzr branch lp:simulide/1.0.0
and then compiled it with QMAKE and MAKE
Both ports are now working along with compilation from within SimulIDE including the -O: option ??
HSerPrint "16F1826" remains non functional
but
HSerPrint PORTB works.

arcachofo

arcachofo

Forget my earlier comment on GCbasic compilation.
I have synched the 819 branch using
bzr branch lp:simulide/1.0.0
and then compiled it with QMAKE and MAKE
Great!!

Both ports are now working along with compilation from within SimulIDE including the -O: option ??
Good to know.

HSerPrint "16F1826" remains non functional
but
HSerPrint PORTB works.
I found an issue with usart.
I will let you know when it's solved.
I assume that "works" means that Serial monitor shows the text/value.

I'm testing ADC:
- Basic reading OK
- Interrupt OK
- Left/Right justified OK.

I will add the results of all our testing to the first post to keep track of what is working or not.

arcachofo

arcachofo

HSerPrint "16F1826" remains non functional
but
HSerPrint PORTB works.
Looks like Eusart is working, but there is a problem with FSR/INDF.

Testing should be done without using libraries, just setting registers asociated with that periferical and nothing else.
Because if it doesn't work, you don't know if the periferical is not working or it's something else in the libraries.

In this case finding the problem with HSerPrint was not too difficult and I could find a problem in the instruction decoder.
I'm working right now to fix it.

I'm updating information in the first post.
Specially about testing done and not done.
For example Ports and Timer0.

MSABU



OK will look into this and what remains to be tested.

arcachofo

arcachofo

Problem with HSerPrint should be solved at Rev. 824.

I was not aware that INDF could also be used to read Program Memory.

MSABU



Rev.837 Quick Update (not much time this week)
HSerPrint "Text" does output a string on the serial monitor. Still outputs variable or PORTs value.
Will look into interupts later.
Problem with GCB compilation is back.
Rev.815 generates properly a .hex and .asm and stores them into the build folder.
Rev.837 states that compilation is a success but does not generates a .hex.
Terminal outputs from both are different.
Rev.815 : wrote:Compiling /home/fg/PROGRAMS/PIC_Simul_Prog/SimulIDE_1.0.0-R837/Test_16f1826/16f1826_USART.gcb ...
Done
Assembling program ...
Program assembled successfully
    SUCCESS!!! Compilation Ok

Rev.837 : wrote:To compile a file, drag and drop it onto the icon for this program. See
Getting Started with GCBASIC for more info.

Command line parameters:
GCBASIC [/O.asm] [/A] [/P] [/K:{C|A}] [/V] [/L]
       [/R] [/S.ini] [/NP] [/WX] [/F] filename

       /O:output.asm   Set an output filename other than the default
       /CP             Send the default config selected by the compiler to a .CONFIG file.
       /A:assembler    Batch file used to call assembler. If /A:GCASM is
                         given, GCBASIC will use its internal assembler.
       /P:programmer   Batch file used to call programmer, or programmer
                     name if defined in settings file.
       /K:{C|A}        Keep original code in assembly output. /K:C will
                         save comments, /K:A will preserve all input code.
       /R:format       Write a compilation report. Format can be html, text
                         or none.
       /S:settings.ini Specify name of settings file to load
       /V              Verbose mode
       /L              Show license
       /NP             Do not pause on errors. Use with IDEs.
       /WX             Treat warnings as errors
       /F              Skip compilation if up to date hex file found, call
                         programmer immediately and then exit.
       /Version        Display the version of the software.
       filename        The file to compile.

You may use - in place of /, such as -V instead of /V.
Press any key to continue

    SUCCESS!!! Compilation Ok
Rev. 837 output looks like what happens when you call gcbasic without giving it a file to compile.
Will recompile SimulIDE at a different location to double check.

MSABU



I have compiled Rev. 840 and GCB compilation issue is still there : no hex output.
File to compile info not given to gcbasic.

arcachofo

arcachofo

HSerPrint "Text" does output a string on the serial monitor. Still outputs variable or PORTs value.
Nice, that can help in further debugging.

MSABU wrote:Rev.837 states that compilation is a success but does not generates a .hex
Issue solved at Rev 841.

MSABU



Confirmed with Rev 841. Compiling and firmware uploading functional.

arcachofo likes this post

MSABU



Arcachofo wrote:Eusart test:
- Basic test: Serial monitor working, Serial echo.
- Basic communication between 2 p16f1826.

I have been able to get serial communication between two 16F1826.
One sending a pulse signal. The second one detecting it.
Opening 2 serial monitors (one for each) displays the proper behavior.
So echo and 2 PICs communication is functional.
Need to move to interrupts now since I did my serial testing by continuously polling Rx but need to use an Rx Interrupt subroutine.

arcachofo

arcachofo

I have been able to get serial communication between two 16F1826.
One sending a pulse signal. The second one detecting it.
Opening 2 serial monitors (one for each) displays the proper behavior.
So echo and 2 PICs communication is functional.
Need to move to interrupts now since I did my serial testing by continuously polling Rx but need to use an Rx Interrupt subroutine.
Great!!
I will update the first post.

I'm working in Timers external clock and testing it in some devices.
I will do some test is 16F1826 as well.

arcachofo

arcachofo

Timer0 mostly tested.
Working on Timer1.
I will take care of all Timers.

Sponsored content



Back to top  Message [Page 2 of 3]

Go to page : Previous  1, 2, 3  Next

Permissions in this forum:
You cannot reply to topics in this forum